Skip to content

Commit 4617050

Browse files
authored
test: ts esnext (#2584)
1 parent 2bf24dd commit 4617050

File tree

5 files changed

+53
-0
lines changed

5 files changed

+53
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Rimuru Tempest');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions": {
3+
"module": "esnext",
4+
"allowSyntheticDefaultImports": true
5+
}
6+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// eslint-disable-next-line node/no-unpublished-require
2+
const { run, isWebpack5 } = require('../../../utils/test-utils');
3+
const { existsSync } = require('fs');
4+
const { resolve } = require('path');
5+
6+
describe('webpack cli', () => {
7+
it('should support typescript esnext file', async () => {
8+
const isMacOS = process.platform === 'darwin';
9+
const majorNodeVersion = process.version.slice(1, 3);
10+
if (majorNodeVersion < 14) {
11+
expect(true).toBe(true);
12+
13+
return;
14+
}
15+
16+
if (isMacOS && !isWebpack5) {
17+
expect(true).toBe(true);
18+
19+
return;
20+
}
21+
22+
const { exitCode, stderr, stdout } = await run(__dirname, ['-c', './webpack.config.ts'], {
23+
nodeOptions: ['--loader=ts-node/esm'],
24+
});
25+
expect(stderr).not.toBeFalsy();
26+
expect(stdout).toBeTruthy();
27+
expect(exitCode).toBe(0);
28+
expect(existsSync(resolve(__dirname, 'dist/foo.bundle.js'))).toBeTruthy();
29+
});
30+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* eslint-disable node/no-unsupported-features/es-syntax */
2+
import * as path from 'path';
3+
4+
const config = {
5+
mode: 'production',
6+
entry: './main.ts',
7+
output: {
8+
path: path.resolve('dist'),
9+
filename: 'foo.bundle.js',
10+
},
11+
};
12+
13+
export default config;

0 commit comments

Comments
 (0)