From 39b9f9ba6b65815f051e369c7e14a7d4e3f63c44 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Wed, 29 Apr 2020 17:24:04 +0200 Subject: [PATCH] Force top-level graceful-fs to be 4.2.4, and add a sanity test (This makes sure all the graceful-fs'es dedupe to the right version so there's only one copy of the cached cwd while jest executes) --- package.json | 1 + packages/decdk/test/sanity.test.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 packages/decdk/test/sanity.test.ts diff --git a/package.json b/package.json index 3a486f40e72f4..04fb80b659ee8 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "jsii-rosetta": "^1.4.1", "lerna": "^3.20.2", "standard-version": "^7.1.0", + "graceful-fs": "^4.2.4", "typescript": "~3.8.3" }, "repository": { diff --git a/packages/decdk/test/sanity.test.ts b/packages/decdk/test/sanity.test.ts new file mode 100644 index 0000000000000..ae876d61c9698 --- /dev/null +++ b/packages/decdk/test/sanity.test.ts @@ -0,0 +1,15 @@ +import * as path from 'path'; + +test('path.resolve is sane', async () => { + // Reasons why this might not be true: + // graceful-fs, which is used by Jest, hooks into process.cwd() and + // process.chdir() and caches the values. Because... profit? + + const targetDir = path.join(__dirname, 'fixture'); + + process.chdir(targetDir); + expect(process.cwd()).toEqual(targetDir); + + const resolved = path.resolve('.'); + expect(resolved).toEqual(targetDir); +}); \ No newline at end of file