-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use tmp directory in chdir test
This patch - makes chdir test to use the tmp directory - moves the test to parallel - renames the file to test-process-chdir as chdir is in process module
- Loading branch information
1 parent
52f84ad
commit 263bdcb
Showing
2 changed files
with
28 additions
and
38 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
assert.notStrictEqual(process.cwd(), __dirname); | ||
process.chdir(__dirname); | ||
assert.strictEqual(process.cwd(), __dirname); | ||
|
||
const dir = path.resolve(common.tmpDir, | ||
'weird \uc3a4\uc3ab\uc3af characters \u00e1\u00e2\u00e3'); | ||
|
||
// Make sure that the tmp directory is clean | ||
common.refreshTmpDir(); | ||
|
||
fs.mkdirSync(dir); | ||
process.chdir(dir); | ||
assert.strictEqual(process.cwd(), dir); | ||
|
||
process.chdir('..'); | ||
assert.strictEqual(process.cwd(), path.resolve(common.tmpDir)); | ||
|
||
assert.throws(function() { process.chdir({}); }, TypeError, 'Bad argument.'); | ||
assert.throws(function() { process.chdir(); }, TypeError, 'Bad argument.'); | ||
assert.throws(function() { process.chdir('x', 'y'); }, | ||
TypeError, 'Bad argument.'); |
This file was deleted.
Oops, something went wrong.