-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
93 additions
and
26 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
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,61 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ConfigTestCases records issue-2991 exported tests should write relative paths to records 1`] = ` | ||
"{ | ||
\\"modules\\": { | ||
\\"byIdentifier\\": { | ||
\\"external \\\\\\"path\\\\\\"\\": 0, | ||
\\"external \\\\\\"fs\\\\\\"\\": 1, | ||
\\"ignored pkgs/somepackage/foo\\": 2, | ||
\\"test.js\\": 3 | ||
}, | ||
\\"usedIds\\": { | ||
\\"0\\": 0, | ||
\\"1\\": 1, | ||
\\"2\\": 2, | ||
\\"3\\": 3 | ||
} | ||
}, | ||
\\"chunks\\": { | ||
\\"byName\\": { | ||
\\"main\\": 0 | ||
}, | ||
\\"bySource\\": {}, | ||
\\"usedIds\\": [ | ||
0 | ||
] | ||
} | ||
}" | ||
`; | ||
|
||
exports[`ConfigTestCases records issue-7339 exported tests should write relative dynamic-require paths to records 1`] = ` | ||
"{ | ||
\\"modules\\": { | ||
\\"byIdentifier\\": { | ||
\\"dependencies/foo.js\\": 0, | ||
\\"dependencies/bar.js\\": 1, | ||
\\"external \\\\\\"path\\\\\\"\\": 2, | ||
\\"external \\\\\\"fs\\\\\\"\\": 3, | ||
\\"dependencies sync /^\\\\\\\\.\\\\\\\\/.*$/\\": 4, | ||
\\"test.js\\": 5 | ||
}, | ||
\\"usedIds\\": { | ||
\\"0\\": 0, | ||
\\"1\\": 1, | ||
\\"2\\": 2, | ||
\\"3\\": 3, | ||
\\"4\\": 4, | ||
\\"5\\": 5 | ||
} | ||
}, | ||
\\"chunks\\": { | ||
\\"byName\\": { | ||
\\"main\\": 0 | ||
}, | ||
\\"bySource\\": {}, | ||
\\"usedIds\\": [ | ||
0 | ||
] | ||
} | ||
}" | ||
`; |
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,34 +1,10 @@ | ||
try { | ||
require("pkgs/somepackage/foo"); | ||
} catch(e){} | ||
} catch (e) {} | ||
|
||
it("should write relative paths to records", function() { | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var content = fs.readFileSync(path.join(__dirname, "records.json"), "utf-8"); | ||
expect(content).toEqual(`{ | ||
"modules": { | ||
"byIdentifier": { | ||
"external \\"path\\"": 0, | ||
"external \\"fs\\"": 1, | ||
"ignored pkgs/somepackage/foo": 2, | ||
"test.js": 3 | ||
}, | ||
"usedIds": { | ||
"0": 0, | ||
"1": 1, | ||
"2": 2, | ||
"3": 3 | ||
} | ||
}, | ||
"chunks": { | ||
"byName": { | ||
"main": 0 | ||
}, | ||
"bySource": {}, | ||
"usedIds": [ | ||
0 | ||
] | ||
} | ||
}`); | ||
expect(content).toMatchSnapshot(); | ||
}); |
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 @@ | ||
module.exports = "Bar" |
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 @@ | ||
module.exports = "Foo" |
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 @@ | ||
function loadDependency(dep) { | ||
require("./dependencies/" + dep); | ||
} | ||
|
||
it("should write relative dynamic-require paths to records", function() { | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var content = fs.readFileSync(path.join(__dirname, "records.json"), "utf-8"); | ||
expect(content).toMatchSnapshot(); | ||
}); |
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,13 @@ | ||
var path = require("path"); | ||
|
||
module.exports = { | ||
entry: "./test", | ||
recordsOutputPath: path.resolve( | ||
__dirname, | ||
"../../../js/config/records/issue-7339/records.json" | ||
), | ||
target: "node", | ||
node: { | ||
__dirname: false | ||
} | ||
}; |