-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: add import smoke tests for cjs, esm, ts for both Node and Bun
- Loading branch information
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// @ts-check | ||
/* eslint-disable @typescript-eslint/no-var-requires, no-console */ | ||
|
||
const assert = require('node:assert'); | ||
const concurrently = require('../index.js'); | ||
|
||
(async () => { | ||
try { | ||
// Assert the functions loaded by checking their names load and types are correct | ||
assert.strictEqual( | ||
typeof concurrently === 'function', | ||
true, | ||
'Expected default to be function', | ||
); | ||
|
||
console.info('Imported cjs successfully'); | ||
} catch (error) { | ||
console.error(error); | ||
console.debug(error.stack); | ||
|
||
// Prevent an unhandled rejection, exit gracefully. | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @ts-check | ||
/* eslint-disable no-console */ | ||
|
||
import assert from 'node:assert'; | ||
|
||
import concurrently from '../index.mjs'; | ||
|
||
(async () => { | ||
try { | ||
// Assert the functions loaded by checking their names load and types are correct | ||
assert.strictEqual( | ||
typeof concurrently === 'function', | ||
true, | ||
'Expected default to be function', | ||
); | ||
|
||
console.info('Imported esm successfully'); | ||
} catch (error) { | ||
console.error(error); | ||
console.debug(error.stack); | ||
|
||
// Prevent an unhandled rejection, exit gracefully. | ||
process.exit(1); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable no-console */ | ||
|
||
import assert from 'node:assert'; | ||
|
||
(async () => { | ||
try { | ||
const { default: esm } = await import('../index.mjs'); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { default: cjs } = require('../index.js'); | ||
|
||
// Assert the functions loaded by checking their names load and types are correct | ||
assert.strictEqual(typeof esm === 'function', true, 'Expected esm default to be function'); | ||
assert.strictEqual(typeof cjs === 'function', true, 'Expected cjs default to be function'); | ||
|
||
console.info('Imported with both CJS and ESM successfully'); | ||
} catch (error) { | ||
console.error(error); | ||
console.debug(error.stack); | ||
|
||
// Prevent an unhandled rejection, exit gracefully. | ||
process.exit(1); | ||
} | ||
})(); |