Skip to content

Commit

Permalink
sort for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jan 7, 2020
1 parent 8e3b8ca commit 0444e1b
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions tests/lib/cli-engine/cli-engine.js
Expand Up @@ -5518,23 +5518,29 @@ describe("CLIEngine", () => {

it("'executeOnFiles()' with a directory path should contain 'foo/test.txt'.", () => {
const engine = new InMemoryCLIEngine();
const filePaths = engine.executeOnFiles(".").results.map(r => r.filePath);
const filePaths = engine.executeOnFiles(".")
.results
.map(r => r.filePath)
.sort();

assert.deepStrictEqual(filePaths, [
path.join(root, "bar/test.js"),
path.join(root, "foo/test.js"),
path.join(root, "foo/test.txt"),
path.join(root, "bar/test.js"),
path.join(root, "test.js")
]);
});

it("'executeOnFiles()' with a glob pattern '*.js' should not contain 'foo/test.txt'.", () => {
const engine = new InMemoryCLIEngine();
const filePaths = engine.executeOnFiles("**/*.js").results.map(r => r.filePath);
const filePaths = engine.executeOnFiles("**/*.js")
.results
.map(r => r.filePath)
.sort();

assert.deepStrictEqual(filePaths, [
path.join(root, "foo/test.js"),
path.join(root, "bar/test.js"),
path.join(root, "foo/test.js"),
path.join(root, "test.js")
]);
});
Expand Down Expand Up @@ -5565,13 +5571,16 @@ describe("CLIEngine", () => {

it("'executeOnFiles()' with a directory path should contain 'foo/test.txt' and 'foo/nested/test.txt'.", () => {
const engine = new InMemoryCLIEngine();
const filePaths = engine.executeOnFiles(".").results.map(r => r.filePath);
const filePaths = engine.executeOnFiles(".")
.results
.map(r => r.filePath)
.sort();

assert.deepStrictEqual(filePaths, [
path.join(root, "bar/test.js"),
path.join(root, "foo/nested/test.txt"),
path.join(root, "foo/test.js"),
path.join(root, "foo/test.txt"),
path.join(root, "bar/test.js"),
path.join(root, "test.js")
]);
});
Expand Down Expand Up @@ -5602,11 +5611,14 @@ describe("CLIEngine", () => {

it("'executeOnFiles()' with a directory path should NOT contain 'foo/test.txt' and 'foo/nested/test.txt'.", () => {
const engine = new InMemoryCLIEngine();
const filePaths = engine.executeOnFiles(".").results.map(r => r.filePath);
const filePaths = engine.executeOnFiles(".")
.results
.map(r => r.filePath)
.sort();

assert.deepStrictEqual(filePaths, [
path.join(root, "foo/test.js"),
path.join(root, "bar/test.js"),
path.join(root, "foo/test.js"),
path.join(root, "test.js")
]);
});
Expand Down Expand Up @@ -5640,13 +5652,16 @@ describe("CLIEngine", () => {

it("'executeOnFiles()' with a directory path should contain 'foo/test.txt' and 'foo/nested/test.txt'.", () => {
const engine = new InMemoryCLIEngine();
const filePaths = engine.executeOnFiles(".").results.map(r => r.filePath);
const filePaths = engine.executeOnFiles(".")
.results
.map(r => r.filePath)
.sort();

assert.deepStrictEqual(filePaths, [
path.join(root, "bar/test.js"),
path.join(root, "foo/nested/test.txt"),
path.join(root, "foo/test.js"),
path.join(root, "foo/test.txt"),
path.join(root, "bar/test.js"),
path.join(root, "test.js")
]);
});
Expand Down Expand Up @@ -5682,13 +5697,16 @@ describe("CLIEngine", () => {

it("'executeOnFiles()' with a directory path should contain 'foo/test.txt' and 'foo/nested/test.txt'.", () => {
const engine = new InMemoryCLIEngine();
const filePaths = engine.executeOnFiles(".").results.map(r => r.filePath);
const filePaths = engine.executeOnFiles(".")
.results
.map(r => r.filePath)
.sort();

assert.deepStrictEqual(filePaths, [
path.join(root, "bar/test.js"),
path.join(root, "foo/nested/test.txt"),
path.join(root, "foo/test.js"),
path.join(root, "foo/test.txt"),
path.join(root, "bar/test.js"),
path.join(root, "test.js")
]);
});
Expand Down

0 comments on commit 0444e1b

Please sign in to comment.