@@ -11,59 +11,69 @@ const fs = require('fs')
1111const TEST_DIR = path . join ( __dirname , '.' )
1212process . chdir ( TEST_DIR )
1313
14- describe ( 'esbuild' , ( ) => {
15- before ( ( ) => {
16- chproc . execSync ( 'npm install' , {
17- timeout : 1000 * 30
14+ // This should switch to our withVersion helper. The order here currently matters.
15+ const esbuildVersions = [ 'latest' , '0.16.12' ]
16+
17+ esbuildVersions . forEach ( ( version ) => {
18+ describe ( `esbuild ${ version } ` , ( ) => {
19+ before ( ( ) => {
20+ chproc . execSync ( 'npm install' , {
21+ timeout : 1000 * 30
22+ } )
23+ if ( version !== 'latest' ) {
24+ chproc . execSync ( `npm install esbuild@${ version } ` , {
25+ timeout : 1000 * 30
26+ } )
27+ }
1828 } )
19- } )
2029
21- it ( 'works' , ( ) => {
22- console . log ( 'npm run build' )
23- chproc . execSync ( 'npm run build' )
30+ it ( 'works' , ( ) => {
31+ console . log ( 'npm run build' )
32+ chproc . execSync ( 'npm run build' )
2433
25- console . log ( 'npm run built' )
26- try {
27- chproc . execSync ( 'npm run built' , {
34+ console . log ( 'npm run built' )
35+ try {
36+ chproc . execSync ( 'npm run built' , {
37+ timeout : 1000 * 30
38+ } )
39+ } catch ( err ) {
40+ console . error ( err )
41+ process . exit ( 1 )
42+ } finally {
43+ fs . rmSync ( './out.js' , { force : true } )
44+ }
45+ } )
46+
47+ it ( 'does not bundle modules listed in .external' , ( ) => {
48+ const command = 'node ./build-and-test-skip-external.js'
49+ console . log ( command )
50+ chproc . execSync ( command , {
2851 timeout : 1000 * 30
2952 } )
30- } catch ( err ) {
31- console . error ( err )
32- process . exit ( 1 )
33- } finally {
34- fs . rmSync ( './out.js' , { force : true } )
35- }
36- } )
37-
38- it ( 'does not bundle modules listed in .external' , ( ) => {
39- const command = 'node ./build-and-test-skip-external.js'
40- console . log ( command )
41- chproc . execSync ( command , {
42- timeout : 1000 * 30
4353 } )
44- } )
4554
46- it ( 'handles typescript apps that import without file extensions' , ( ) => {
47- const command = 'node ./build-and-test-typescript.mjs'
48- console . log ( command )
49- chproc . execSync ( command , {
50- timeout : 1000 * 30
55+ it ( 'handles typescript apps that import without file extensions' , ( ) => {
56+ const command = 'node ./build-and-test-typescript.mjs'
57+ console . log ( command )
58+ chproc . execSync ( command , {
59+ timeout : 1000 * 30
60+ } )
5161 } )
52- } )
5362
54- it ( 'handles the complex aws-sdk package with dynamic requires' , ( ) => {
55- const command = 'node ./build-and-test-aws-sdk.js'
56- console . log ( command )
57- chproc . execSync ( command , {
58- timeout : 1000 * 30
63+ it ( 'handles the complex aws-sdk package with dynamic requires' , ( ) => {
64+ const command = 'node ./build-and-test-aws-sdk.js'
65+ console . log ( command )
66+ chproc . execSync ( command , {
67+ timeout : 1000 * 30
68+ } )
5969 } )
60- } )
6170
62- it ( 'handles scoped node_modules' , ( ) => {
63- const command = 'node ./build-and-test-koa.mjs'
64- console . log ( command )
65- chproc . execSync ( command , {
66- timeout : 1000 * 30
71+ it ( 'handles scoped node_modules' , ( ) => {
72+ const command = 'node ./build-and-test-koa.mjs'
73+ console . log ( command )
74+ chproc . execSync ( command , {
75+ timeout : 1000 * 30
76+ } )
6777 } )
6878 } )
6979} )
0 commit comments