-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ef0f29
commit 06100b1
Showing
3 changed files
with
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ jobs: | |
run: | | ||
npm run lint | ||
npm run coverage | ||
npm run test:dist |
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,28 @@ | ||
import assert from 'node:assert'; | ||
import cluster from 'node:cluster'; | ||
import { describe, it } from 'node:test'; | ||
|
||
if (!cluster.isPrimary) { | ||
import('../dist/index.js'); | ||
} else { | ||
describe('dist build', () => { | ||
it('loads and doesn\'t crash', async () => { | ||
await import('../dist/index.js'); | ||
|
||
await new Promise((resolve, reject) => { | ||
setTimeout(resolve, 10000).unref(); | ||
cluster.removeAllListeners('exit'); | ||
|
||
cluster.on('exit', ({ code, signal }) => { | ||
reject(new assert.AssertionError({ message: `Exited with code ${code}, signal ${signal}.` })); | ||
}); | ||
}); | ||
|
||
cluster.removeAllListeners('exit'); | ||
|
||
Object.values(cluster.workers).forEach((worker) => { | ||
worker.kill(); | ||
}); | ||
}); | ||
}); | ||
} |