-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn when backslashes are used in paths/globs on Windows
Backslashes behave inconsistently between OSes in the version of glob that Jasmine currently uses, and the next major verison of glob will treat them as escape sequences rather than path separators on all OSes.
- Loading branch information
Showing
5 changed files
with
222 additions
and
10 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 |
---|---|---|
@@ -1,11 +1,24 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path'); | ||
const os = require('os'); | ||
const Command = require('../lib/command'); | ||
const Jasmine = require('../lib/jasmine'); | ||
|
||
const jasmine = new Jasmine({ projectBaseDir: path.resolve() }); | ||
let projectBaseDir = path.resolve(); | ||
|
||
if (os.platform() === 'win32') { | ||
// Future versions of glob will interpret backslashes as escape sequences on | ||
// all platforms, and Jasmine warns about them. Convert to slashes to avoid | ||
// the warning and future behavior change. | ||
projectBaseDir = projectBaseDir.replace(/\\/g, '/'); | ||
} | ||
|
||
const jasmine = new Jasmine({ projectBaseDir }); | ||
const examplesDir = path.join(path.dirname(require.resolve('jasmine-core')), 'jasmine-core', 'example', 'node_example'); | ||
const command = new Command(path.resolve(), examplesDir, console.log); | ||
const command = new Command(path.resolve(), examplesDir, { | ||
print: console.log, | ||
platform: os.platform, | ||
}); | ||
|
||
command.run(jasmine, process.argv.slice(2)); |
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