mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
back to mocha, working in future node versions
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
{
|
||||
"extensions": ["ts"],
|
||||
"spec": ["lib/js-api/test/**/*.spec.ts"],
|
||||
"node-option": [
|
||||
"loader=ts-node/register"
|
||||
]
|
||||
"spec": ["dist/tmp/libs/js-api/test/**/*.spec.js"]
|
||||
}
|
||||
|
64
lib/js-api/project.json
Normal file
64
lib/js-api/project.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "js-api",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "lib/js-api",
|
||||
"projectType": "library",
|
||||
"prefix": "adf",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nrwl/js:tsc",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"options": {
|
||||
"outputPath": "dist/libs/js-api",
|
||||
"main": "lib/js-api/src/index.ts",
|
||||
"tsConfig": "lib/js-api/tsconfig.lib.json",
|
||||
"assets": ["lib/js-api/*.md"],
|
||||
"externalBuildTargets": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"configurations": {
|
||||
"test": {
|
||||
"outputPath": "dist/tmp/libs/js-api",
|
||||
"tsConfig": "lib/js-api/tsconfig.spec.json",
|
||||
"assets": [
|
||||
"lib/js-api/test/mockObjects/assets/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"publish": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"command": "node tools/scripts/publish.mjs lib-js-api {args.ver} {args.tag}"
|
||||
},
|
||||
"dependsOn": ["build"]
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["lib/js-api/**/*.ts"]
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "nx:run-commands",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"commands": [
|
||||
"nx run js-api:build:test",
|
||||
"mocha --full-trace --config lib/js-api/.mocharc.json",
|
||||
"rm -fr dist/tmp/libs/js-api"
|
||||
],
|
||||
"parallel": false
|
||||
},
|
||||
"configurations": {
|
||||
"ci": {
|
||||
"ci": true,
|
||||
"codeCoverage": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
@@ -53,7 +53,13 @@ describe('Oauth2 Implicit flow test', () => {
|
||||
});
|
||||
|
||||
it('should redirect to login if access token is not valid', (done) => {
|
||||
window = globalAny.window = { location: {} };
|
||||
window = globalAny.window = {
|
||||
location: {
|
||||
assign: (v: any) => {
|
||||
window.location.href = v;
|
||||
}
|
||||
}
|
||||
};
|
||||
globalAny.document = {
|
||||
getElementById: () => ''
|
||||
};
|
||||
@@ -81,7 +87,13 @@ describe('Oauth2 Implicit flow test', () => {
|
||||
});
|
||||
|
||||
it('should not loop over redirection when redirectUri contains hash and token is not valid ', (done) => {
|
||||
window = globalAny.window = { location: {} };
|
||||
window = globalAny.window = {
|
||||
location: {
|
||||
assign: (v: any) => {
|
||||
window.location.href = v;
|
||||
}
|
||||
}
|
||||
};
|
||||
globalAny.document = {
|
||||
getElementById: () => ''
|
||||
};
|
||||
@@ -112,7 +124,13 @@ describe('Oauth2 Implicit flow test', () => {
|
||||
});
|
||||
|
||||
it('should not redirect to login if access token is valid', (done) => {
|
||||
window = globalAny.window = { location: {} };
|
||||
window = globalAny.window = {
|
||||
location: {
|
||||
assign: (v: any) => {
|
||||
window.location.href = v;
|
||||
}
|
||||
}
|
||||
};
|
||||
globalAny.document = {
|
||||
getElementById: () => ''
|
||||
};
|
||||
@@ -144,11 +162,17 @@ describe('Oauth2 Implicit flow test', () => {
|
||||
});
|
||||
|
||||
it('should set the loginFragment to redirect after the login if it is present', (done) => {
|
||||
window = globalAny.window = {};
|
||||
window = globalAny.window = {
|
||||
location: {
|
||||
assign: (v: any) => {
|
||||
window.location.href = v;
|
||||
}
|
||||
}
|
||||
};
|
||||
globalAny.document = {
|
||||
getElementById: () => ''
|
||||
};
|
||||
window.location = <Location>{ hash: 'asfasfasfa' };
|
||||
window.location.hash = 'asfasfasfa';
|
||||
|
||||
Object.defineProperty(window.location, 'hash', {
|
||||
writable: true,
|
||||
|
@@ -8,7 +8,6 @@
|
||||
"isolatedModules": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"skipLibCheck": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"types": ["mocha"]
|
||||
"skipDefaultLibCheck": true
|
||||
}
|
||||
}
|
||||
|
16
lib/js-api/tsconfig.spec.json
Normal file
16
lib/js-api/tsconfig.spec.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"target": "ES2015",
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"skipLibCheck": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"types": ["mocha"]
|
||||
},
|
||||
"exclude": [],
|
||||
"include": ["**/*"]
|
||||
}
|
Reference in New Issue
Block a user