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
9 changed files
with
153 additions
and
40 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var module = 123; | ||
var define = 456; | ||
export default function(exports) { | ||
exports.property = module; | ||
define({}); | ||
} |
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,4 +1,6 @@ | ||
it("should result in a warning when using module.exports in harmony module", function() { | ||
var x = require("./wrong-module"); | ||
x.should.be.eql(1234); | ||
var y = require("./correct-module"); | ||
y.should.have.property("default").be.type("function"); | ||
}); |
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ module.exports = "abc"; | |
define([], function() { | ||
return 1234 | ||
}); | ||
f(define); | ||
exports.property = true; |
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,94 @@ | ||
var should = require("should"); | ||
var formatLocation = require("../lib/formatLocation"); | ||
|
||
describe("formatLocation", () => { | ||
var testCases = [{ | ||
name: "undefined", | ||
loc: undefined, | ||
result: "" | ||
}, { | ||
name: "null", | ||
loc: null, | ||
result: "" | ||
}, { | ||
name: "string", | ||
loc: "str", | ||
result: "str" | ||
}, { | ||
name: "number", | ||
loc: 12, | ||
result: "12" | ||
}, { | ||
name: "line-column", | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 3, | ||
column: 4 | ||
} | ||
}, | ||
result: "1:2-3:4" | ||
}, { | ||
name: "line-column (same line)", | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 4 | ||
} | ||
}, | ||
result: "1:2-4" | ||
}, { | ||
name: "line-column (start only)", | ||
loc: { | ||
start: { | ||
line: 5, | ||
column: 6 | ||
} | ||
}, | ||
result: "5:6" | ||
}, { | ||
name: "start-end string", | ||
loc: { | ||
start: "start", | ||
end: "end" | ||
}, | ||
result: "start-end" | ||
}, { | ||
name: "start-end number", | ||
loc: { | ||
start: 9, | ||
end: 7 | ||
}, | ||
result: "9-7" | ||
}, { | ||
name: "line", | ||
loc: { | ||
start: { | ||
line: 10 | ||
}, | ||
end: { | ||
index: 20 | ||
} | ||
}, | ||
result: "10:?-+20" | ||
}, { | ||
name: "line", | ||
loc: { | ||
start: null, | ||
end: /f/ | ||
}, | ||
"" | ||
}]; | ||
testCases.forEach(testCase => { | ||
it(`should format location correctly for ${testCase.name}`, () => { | ||
formatLocation(testCase.loc).should.be.eql(testCase.result); | ||
}); | ||
}); | ||
}); |