Skip to content

test: isolate individual assert test to improve test hygiene - #20861

Closed
Trott wants to merge 2 commits into
nodejs:masterfrom
Trott:write-in-tmp
Closed

test: isolate individual assert test to improve test hygiene#20861
Trott wants to merge 2 commits into
nodejs:masterfrom
Trott:write-in-tmp

Conversation

@Trott

Copy link
Copy Markdown
Member

First commit:

test: isolate unusual assert test in its own file
test-assert.js contains a test that writes to the source tree, requires
an internal module, and depends on modules not needed by the plethora of
other test cases in the file. Move it to its own file so that there are
not side effects in test-assert.js and so that it can be refactored to
not write to the source tree.

Second commit:

test: improve assert test hygiene
Do not pollute the source tree for the test. Instead of writing to the
source tree, spawn a process with the temp dir as cwd and write the file
there.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label May 21, 2018
@Trott

Copy link
Copy Markdown
MemberAuthor

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 21, 2018
@Trott

Copy link
Copy Markdown
MemberAuthor

Windows is the only platform that wasn't green/yellow, but it was an unrelated (and known) failure.

Windows re-run: https://ci.nodejs.org/job/node-test-commit-windows-fanned/18166/

@BridgeAR

Copy link
Copy Markdown
Member

This needs a rebase.

Trott added 2 commits May 24, 2018 10:55
test-assert.js contains a test that writes to the source tree, requires
an internal module, and depends on modules not needed by the plethora of
other test cases in the file. Move it to its own file so that there are
not side effects in test-assert.js and so that it can be refactored to
not write to the source tree.
Do not pollute the source tree for the test. Instead of writing to the
source tree, spawn a process with the temp dir as cwd and write the file
there.
@Trott

Copy link
Copy Markdown
MemberAuthor

Rebased.

@Trott

Copy link
Copy Markdown
MemberAuthor

@Trott

Copy link
Copy Markdown
MemberAuthor

Trott added a commit to Trott/io.js that referenced this pull request May 28, 2018
test-assert.js contains a test that writes to the source tree, requires
an internal module, and depends on modules not needed by the plethora of
other test cases in the file. Move it to its own file so that there are
not side effects in test-assert.js and so that it can be refactored to
not write to the source tree.
PR-URL: nodejs#20861
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request May 28, 2018
Do not pollute the source tree for the test. Instead of writing to the
source tree, spawn a process with the temp dir as cwd and write the file
there.
PR-URL: nodejs#20861
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
@Trott

Copy link
Copy Markdown
MemberAuthor

Landed in cfc3866...5624a6f

@TrottTrott closed this May 28, 2018
MylesBorins pushed a commit that referenced this pull request May 29, 2018
test-assert.js contains a test that writes to the source tree, requires
an internal module, and depends on modules not needed by the plethora of
other test cases in the file. Move it to its own file so that there are
not side effects in test-assert.js and so that it can be refactored to
not write to the source tree.
PR-URL: #20861
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 29, 2018
Do not pollute the source tree for the test. Instead of writing to the
source tree, spawn a process with the temp dir as cwd and write the file
there.
PR-URL: #20861
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request May 29, 2018
@Trott
Trott deleted the write-in-tmp branch January 13, 2022 22:49
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@Trott@BridgeAR@jasnell@thefourtheye@cjihrig@trivikr@nodejs-github-bot