Skip to content

Commit

Permalink
Merge pull request #309 from iambumblehead/attempt-enable-swc-tests
Browse files Browse the repository at this point in the history
mv tests-FAIL-swc tests-swc
  • Loading branch information
iambumblehead authored Jul 16, 2024
2 parents a16a6fb + 4c58d6c commit 253eec5
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.1.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# changelog

* 2.6.7 _Jul.16.2024_
* [add swc tests and remove swc caution from README](https://github.com/iambumblehead/esmock/pull/309) thanks @Brooooooklyn
* [unpin node 22.1 at test CI](https://github.com/iambumblehead/esmock/pull/309) and use latest 22.x
* 2.6.6 _Jun.15.2024_
* [add tsx tests and remove tsx caution from README](https://github.com/iambumblehead/esmock/pull/305) thanks @galexite
* [pin node 22.1 at test CI](https://github.com/iambumblehead/esmock/pull/306) and ignore regressions in new node 22
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

_**Note: For versions of node prior to v20.6.0,** "--loader" command line arguments must be used with `esmock` as demonstrated [in the wiki.][4] Current versions of node do not require "--loader"._

_**Note: TypeScript loader** `swc-node` is, at time of writing, **incompatible** with other loaders, including esmock._

`esmock` has the below signature
```js
await esmock(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "esmock",
"type": "module",
"version": "2.6.6",
"version": "2.6.7",
"license": "ISC",
"readmeFilename": "README.md",
"description": "provides native ESM import and globals mocking for unit tests",
Expand Down
2 changes: 2 additions & 0 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"isnodegt19": "node -e \"+process.versions.node.split('.')[0] > 19 || process.exit(1)\"",
"isnodenight": "node -e \"process.versions.node.includes('night') || process.exit(1)\"",
"install:esmock": "cd .. && npm install",
"install:test-swc": "cd tests-swc && npm install",
"install:test-ava": "cd tests-ava && npm install",
"install:test-uvu": "cd tests-uvu && npm install",
"install:test-tsm": "cd tests-tsm && npm install",
Expand All @@ -51,6 +52,7 @@
"test:test-mocha": "cd tests-mocha && npm test",
"test:test-ava": "cd tests-ava && npm test",
"test:test-tsx": "cd tests-tsx && npm test",
"test:test-swc": "cd tests-swc && npm test",
"test:node19-tsm": " cd tests-tsm && npm test",
"test:node18-test-tsm": "npm run isnodenight || npm run test:node19-tsm",
"test:node18-test-tsx": "cd tests-tsx && npm run test",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import test from 'node:test'
import assert from 'assert'
import esmock from 'esmock'

// ⚠ https://github.com/swc-project/swc-node/issues/710
// swc tests fail when encountering typescript syntax
// when the typescript sytax are removed, tests pass

// credit @Brooooooklyn https://github.com/swc-project/swc-node/issues/788
test('should mock js when using swc', async () => {
const main = await esmock('../local/main.js', {
path: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"type": "module",
"description": "esmock unit tests, tsm with node native runner",
"description": "esmock unit tests, swc with node native runner",
"repository": {
"type": "git",
"url": "git+https://github.com/iambumblehead/esmock.git"
},
"dependencies": {
"esmock": "file:..",
"@swc-node/register": "1.9.2"
"typescript": "^5.5.3",
"@swc-node/register": "^1.10.8",
"@swc/core": "^1.6.13"
},
"scripts": {
"isloaderavailable": "node -e \"(([mj, mn]) => (+mj < 18 || (+mj === 20 && +mn < 6) || (+mj === 18 && +mn < 19)))(process.versions.node.split('.')) || process.exit(1)\"",
Expand Down
File renamed without changes.

0 comments on commit 253eec5

Please sign in to comment.