Skip to content

Commit

Permalink
Fixed windows tests for globby@10.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
k2snowman69 committed Jul 20, 2019
1 parent cf57048 commit 3327ec2
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 32 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Added support for JSXFragment
- Added support for ArrayPattern
- Added support for JSXEmptyExpression
- Breaking: Updated globby@10.0.0 which [only allows forward slashes in paths](https://github.com/mrmlnc/fast-glob#pattern-syntax)

### 2.6.2

Expand Down
4 changes: 2 additions & 2 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect } from "chai";
import { join } from "path";
import { formatFile, formatText } from "./index";
import { FileUtils } from "./utilities/file-utils";

describe("index", () => {
it("Runs without crashing", () => {
let thisFile = join(__dirname, "index.test.ts");
let thisFile = FileUtils.globbyJoin(__dirname, "index.test.ts");
formatFile(thisFile, {
isTestRun: true
});
Expand Down
2 changes: 1 addition & 1 deletion src/language-css/reprinter/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("language-css/reprinter", () => {
["css", "less"].forEach(cssType => {
let testInfos: TestInfo[];

let assetsFolderPath = join(
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
`test_assets/*.input.${cssType}.txt`
);
Expand Down
7 changes: 5 additions & 2 deletions src/language-html/reprinter/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// The methods being tested here
import { Reprinter } from "./index";
Expand All @@ -18,7 +18,10 @@ interface TestInfo {
describe("language-html/reprinter", () => {
let testInfos: TestInfo[];

let assetsFolderPath = join(__dirname, "test_assets/*.input.html.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.html.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-html/sortAttributes/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse } from "angular-html-parser";
Expand All @@ -11,6 +11,7 @@ import { sortAttributes } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -21,7 +22,10 @@ interface TestInfo {
describe("language-html/sortAttributes", () => {
let testInfos: TestInfo[];

let assetsFolderPath = join(__dirname, "test_assets/*.input.html.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.html.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
7 changes: 5 additions & 2 deletions src/language-js/reprinter/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";
import { FileUtils } from "../../utilities/file-utils";
import { StringUtils } from "../../utilities/string-utils";

Expand All @@ -18,7 +18,10 @@ describe("language-js/reprinter", () => {
let testInfos: TestInfo[];
let parserTypes: Set<string> = new Set<string>();

let assetsFolderPath = join(__dirname, "test_assets/*.input.(js|ts).txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.(js|ts).txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
12 changes: 7 additions & 5 deletions src/language-js/sortClassContents/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortClassContents } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -28,7 +29,10 @@ describe("language-js/sortClassContents", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down Expand Up @@ -75,9 +79,7 @@ describe("language-js/sortClassContents", () => {

testInfos.forEach(testInfo => {
if (testInfo.parserType == fileType) {
it(`${testInfo.order} - ${testInfo.isAscending} - ${
testInfo.testName
}`, () => {
it(`${testInfo.order} - ${testInfo.isAscending} - ${testInfo.testName}`, () => {
let input = readFileSync(testInfo.inputFilePath, "utf8");
let expected = readFileSync(testInfo.outputFilePath, "utf8");
let parsed = parser(input);
Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortExpression/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortExpression } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortExpression", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortImportDeclarationSpecifiers/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortImportDeclarationSpecifiers } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortImportDeclarationSpecifiers", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortImportDeclarations/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortImportDeclarations } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortImportDeclarations", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortJsxElement/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortJsxElement } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortJsxElement", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortObjectTypeAnnotation/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortObjectTypeAnnotation } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortObjectTypeAnnotation", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortSwitchCases/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortSwitchCases } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortSwitchCases", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortTSPropertySignatures/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortTSPropertySignatures } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortTSPropertySignatures", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
8 changes: 6 additions & 2 deletions src/language-js/sortUnionTypeAnnotation/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "chai";
import { readFileSync } from "fs";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// Parsers
import { parse as flowParse } from "../parsers/flow";
Expand All @@ -12,6 +12,7 @@ import { sortUnionTypeAnnotation } from "./index";

// Utilities
import { StringUtils } from "../../utilities/string-utils";
import { FileUtils } from "../../utilities/file-utils";

interface TestInfo {
inputFilePath: string;
Expand All @@ -26,7 +27,10 @@ describe("language-js/sortUnionTypeAnnotation", () => {

parserTypes = [];

let assetsFolderPath = join(__dirname, "test_assets/*.input.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down
7 changes: 5 additions & 2 deletions src/language-json/reprinter/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { sync } from "globby";
import { basename, join } from "path";
import { basename } from "path";

// The methods being tested here
import { Reprinter } from "./index";
Expand All @@ -18,7 +18,10 @@ interface TestInfo {
describe("language-json/reprinter", () => {
let testInfos: TestInfo[];

let assetsFolderPath = join(__dirname, "test_assets/*.input.json.txt");
let assetsFolderPath = FileUtils.globbyJoin(
__dirname,
"test_assets/*.input.json.txt"
);
testInfos = sync(assetsFolderPath).map(filePath => {
let segments = basename(filePath).split(".");

Expand Down

0 comments on commit 3327ec2

Please sign in to comment.