Skip to content

Commit a1af196

Browse files
Merge pull request #649 from georgyangelov/nextgen-support
Upgrade webpack and convert to TS
2 parents bd333de + 8fbde9d commit a1af196

31 files changed

+7056
-8031
lines changed

.browserslistrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://scratch.mit.edu/faq
2+
Chrome >= 63
3+
Edge >= 15
4+
Firefox >= 57
5+
Safari >= 11
6+
Android >= 63
7+
iOS >= 11

jest.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
1+
const {createDefaultEsmPreset} = require('ts-jest');
2+
3+
/** @type {import('ts-jest').JestConfigWithTsJest} */
14
module.exports = {
5+
moduleNameMapper: {
6+
// Allows jest to find the asset files, otherwise it looks for them with the
7+
// `?arrayBuffer` as part of the name and doesn't end up transforming them.
8+
'^(.+)\\?arrayBuffer$': '$1'
9+
},
10+
moduleFileExtensions: ['ts', 'js'],
211
transform: {
12+
...createDefaultEsmPreset({
13+
tsconfig: 'tsconfig.test.json',
14+
15+
// The webpack 5 way to include web workers is to use
16+
// `new Worker(new URL('./worker.js', import.meta.url));`.
17+
// See https://webpack.js.org/guides/web-workers/
18+
// However, the `import.meta.url` is ESM-only and Jest's support for ESM is
19+
// still experimental. So, we need to mock it instead (or use experimental
20+
// jest & node features).
21+
//
22+
// Also see https://www.npmjs.com/package/ts-jest-mock-import-meta
23+
diagnostics: {
24+
ignoreCodes: [1343]
25+
},
26+
astTransformers: {
27+
before: [
28+
{
29+
path: 'ts-jest-mock-import-meta',
30+
options: {metaObjectReplacement: {url: 'https://example.com'}}
31+
}
32+
]
33+
}
34+
}).transform,
335
'\\.(png|svg|wav)$': '<rootDir>/test/transformers/arraybuffer-loader.js'
436
}
537
};

0 commit comments

Comments
 (0)