-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Run tests e2e against an npm pack && npm install
ed ts-node
#1032
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
95cb9bc
Tweak tests to run against packed and installed ts-node instead of lo…
cspotcode f82c7f5
avoid re-building when packing
cspotcode 2869699
fix for node 6
cspotcode 1bbc7cd
move npm pack into build step
cspotcode e7d1ffb
Merge remote-tracking branch 'origin/master' into ab/e2e-tests
cspotcode b56dfde
update package-lock
cspotcode 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
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
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,20 @@ | ||
// Written in JS to support Windows | ||
// Would otherwise be written as inline bash in package.json script | ||
|
||
const { exec } = require('child_process') | ||
const { mkdtempSync, writeFileSync, readFileSync, unlinkSync, rmdirSync, readdirSync } = require('fs') | ||
const { join } = require('path') | ||
|
||
const testDir = join(__dirname, '../tests') | ||
const tarballPath = join(testDir, 'ts-node-packed.tgz') | ||
const tempDir = mkdtempSync(join(testDir, 'tmp')) | ||
exec(`npm pack "${join(__dirname, '..')}"`, { cwd: tempDir }, (err, stdout) => { | ||
if (err) { | ||
console.error(err) | ||
process.exit(1) | ||
} | ||
const tempTarballPath = join(tempDir, readdirSync(tempDir)[0]) | ||
writeFileSync(tarballPath, readFileSync(tempTarballPath)) | ||
unlinkSync(tempTarballPath) | ||
rmdirSync(tempDir) | ||
}) |
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,4 @@ | ||
declare module 'util.promisify' { | ||
const _export: typeof import('util').promisify | ||
export = _export | ||
} |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
!node_modules/ | ||
!from-node-modules/node_modules/ | ||
package-lock.json | ||
ts-node-packed.tgz |
File renamed without changes.
File renamed without changes.
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,5 @@ | ||
{ | ||
"dependencies": { | ||
"ts-node": "file:ts-node-packed.tgz" | ||
} | ||
} |
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.
I wonder if these a way to do this outside of the test suite or possibly a separate set of tests? Either way this looks like a great start at coverage.
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.
I can definitely move the
npm pack
into ournpm build
. That would be better since it wouldnpm pack
using the same node and npm versions as we use topublish
.Are you thinking you want 2x sets of tests, one unit tests, the other doing these e2e-style tests against an
npm install
?I thought about that but I wasn't sure how useful it'd be since the tests mostly look e2e-style already. Your call though, happy to split things out.
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.
Let's keep it how it is then, I don't have strong opinions either way but it's great to know you thought about this.