-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(credential-provider-cognito-identity): export es modules (#882)
- Loading branch information
1 parent
1bdfed2
commit 4c8eb6c
Showing
8 changed files
with
59 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
const base = require("../../jest.config.base.js"); | ||
|
||
module.exports = { | ||
...base | ||
...base, | ||
//only test cjs dist, avoid testing the package twice | ||
testPathIgnorePatterns: ["/node_modules/", "/es/"] | ||
}; |
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
1 change: 0 additions & 1 deletion
1
packages/credential-provider-cognito-identity/src/IndexedDbStorage.ts
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
1 change: 0 additions & 1 deletion
1
packages/credential-provider-cognito-identity/src/fromCognitoIdentityPool.spec.ts
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
30 changes: 23 additions & 7 deletions
30
packages/credential-provider-cognito-identity/src/localStorage-inmemoryStorage.spec.ts
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,13 +1,29 @@ | ||
/** | ||
* @jest-environment node | ||
*/ | ||
|
||
import { localStorage } from "./localStorage"; | ||
import { localStorage as storage } from "./localStorage"; | ||
import { InMemoryStorage } from "./InMemoryStorage"; | ||
|
||
describe("localStorage", () => { | ||
//use node run time in jest(default jsdom) | ||
// set store and restore indexedDB and localStorage before and after the test | ||
let indexDB: any = undefined; | ||
let localStorage: any = undefined; | ||
beforeEach(() => { | ||
if (typeof self === "object") indexDB = self.indexedDB; | ||
if (typeof window === "object") localStorage = window.localStorage; | ||
}); | ||
afterEach(() => { | ||
if (typeof self === "object") defineProperty(self, "indexedDB", indexDB); | ||
if (typeof window === "object") | ||
defineProperty(window, "localStorage", localStorage); | ||
}); | ||
it("should return an in-memory storage implementation when indexDB or localStorage is not available", () => { | ||
expect(localStorage()).toBeInstanceOf(InMemoryStorage); | ||
defineProperty(self, "indexedDB", null); | ||
defineProperty(window, "localStorage", null); | ||
expect(storage()).toBeInstanceOf(InMemoryStorage); | ||
}); | ||
}); | ||
|
||
const defineProperty = (object: any, name: string, value: any) => { | ||
Object.defineProperty(object, name, { | ||
value, | ||
configurable: true | ||
}); | ||
}; |
20 changes: 20 additions & 0 deletions
20
packages/credential-provider-cognito-identity/tsconfig.es.json
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,20 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"declaration": false, | ||
"declarationDir": null, | ||
"downlevelIteration": true, | ||
"lib": [ | ||
"dom", | ||
"es5", | ||
"es2015.promise", | ||
"es2015.collection", | ||
"es2015.iterable", | ||
"es2015.symbol.wellknown" | ||
], | ||
"outDir": "dist/es" | ||
} | ||
} |
17 changes: 6 additions & 11 deletions
17
packages/credential-provider-cognito-identity/tsconfig.json
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,23 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"target": "es2017", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"strict": true, | ||
"sourceMap": true, | ||
"downlevelIteration": true, | ||
"importHelpers": true, | ||
"noEmitHelpers": true, | ||
"lib": [ | ||
"dom", | ||
"es5", | ||
"es2015.promise", | ||
"es2015.collection", | ||
"es2015.iterable", | ||
"es2015.symbol.wellknown" | ||
], | ||
"lib": ["dom"], | ||
"rootDir": "./src", | ||
"outDir": "./build", | ||
"incremental": true | ||
"outDir": "dist/cjs", | ||
"incremental": true, | ||
"declarationDir": "./dist/cjs", | ||
"noUnusedLocals": true | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
packages/credential-provider-cognito-identity/tsconfig.test.json
This file was deleted.
Oops, something went wrong.