-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use folder-hash instead of hash-files. * Fix indentation in jest.config.js * awaits in separate lines
- Loading branch information
1 parent
3dda482
commit ca4682c
Showing
11 changed files
with
7,850 additions
and
2,562 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as fs from "fs"; | ||
import { join } from "path"; | ||
import * as crypto from "crypto"; | ||
|
||
import { hashFiles } from "../src/utils"; | ||
import { hashElement } from "folder-hash"; | ||
|
||
test("test hashFiles on ** pattern", async () => { | ||
const tmpDir = await fs.promises.mkdtemp("cargo-semver-checks-action-test"); | ||
await fs.promises.writeFile(join(tmpDir, "Cargo.lock"), "test1"); | ||
await fs.promises.mkdir(join(tmpDir, "inner")); | ||
await fs.promises.writeFile(join(tmpDir, "inner", "Cargo.lock"), "test2"); | ||
|
||
const hashAll = await hashFiles([join(tmpDir, "**", "Cargo.lock")]); | ||
|
||
const hashNodeOuter = await hashElement(join(tmpDir, "Cargo.lock")); | ||
const hashNodeInner = await hashElement(join(tmpDir, "inner", "Cargo.lock")); | ||
|
||
await fs.promises.rm(tmpDir, { recursive: true }); | ||
|
||
const hasher = crypto.createHash("md5"); | ||
hasher.update(hashNodeOuter.hash); | ||
hasher.update(hashNodeInner.hash); | ||
expect(hashAll).toBe(hasher.digest("hex")); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 @@ | ||
module.exports = { | ||
clearMocks: true, | ||
moduleFileExtensions: ['js', 'ts'], | ||
testMatch: ['**/*.test.ts'], | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest' | ||
}, | ||
verbose: true | ||
} |
Oops, something went wrong.