-
Notifications
You must be signed in to change notification settings - Fork 3
feat: external node_modules
packages by default
#93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
9aoy
wants to merge
15
commits into
main
Choose a base branch
from
external-node-modules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
16b7c0d
test: add more snapshot test cases
9aoy 9604499
fix: merge conflict
9aoy d85ca0b
fix: currentTestName
9aoy a7fd705
fix: test
9aoy 9094868
fix: remove libraryType
9aoy 677bf90
fix: update
9aoy 90b10a9
fix: merge conflict
9aoy 5558494
feat: external node_modules by default
9aoy c162447
fix: update
9aoy c2f2e30
Merge branch 'main' of https://github.com/web-infra-dev/rstest into e…
9aoy 8cc43fc
fix: import reference
9aoy 598e569
fix: update tests
9aoy e242873
fix: update
9aoy aec13f8
fix: add todo
9aoy 21873db
fix: remove todo
9aoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,16 @@ | ||
import { expect, it } from '@rstest/core'; | ||
import stripAnsi from 'strip-ansi'; | ||
|
||
it('should load esm correctly', () => { | ||
expect(stripAnsi('\u001B[4mUnicorn\u001B[0m')).toBe('Unicorn'); | ||
}); | ||
|
||
it('should load esm dynamic correctly', async () => { | ||
const { default: stripAnsi } = await import('strip-ansi'); | ||
expect(stripAnsi('\u001B[4mUnicorn\u001B[0m')).toBe('Unicorn'); | ||
}); | ||
|
||
it('should load cjs with require correctly', () => { | ||
const picocolors = require('picocolors'); | ||
expect(picocolors.green).toBeDefined(); | ||
}); |
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,34 @@ | ||
import fs from 'node:fs'; | ||
import { dirname, join } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { describe, expect, it } from '@rstest/core'; | ||
import { runRstestCli } from '../scripts/'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
describe('test externals', () => { | ||
it('should external node_modules by default', async () => { | ||
process.env.DEBUG_RSTEST_OUTPUTS = 'true'; | ||
const { cli } = await runRstestCli({ | ||
command: 'rstest', | ||
args: ['run', './fixtures/index.test.ts'], | ||
options: { | ||
nodeOptions: { | ||
cwd: __dirname, | ||
}, | ||
}, | ||
}); | ||
|
||
await cli.exec; | ||
expect(cli.exec.process?.exitCode).toBe(0); | ||
|
||
const outputPath = join(__dirname, 'dist/fixtures/index.test.ts.js'); | ||
|
||
expect(fs.existsSync(outputPath)).toBeTruthy(); | ||
const content = fs.readFileSync(outputPath, 'utf-8'); | ||
|
||
expect(content).toContain('require("picocolors")'); | ||
expect(content).toContain('import("strip-ansi")'); | ||
}); | ||
}); |
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,10 @@ | ||
{ | ||
"private": true, | ||
"name": "@rstest/tests-externals", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"@rstest/core": "workspace:*", | ||
"picocolors": "^1.1.1", | ||
"strip-ansi": "^7.1.0" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could put
/node_modules/.test
logic intodoExternal
to convergence the logic.