mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
chore: Enable/disable Docker testing with a flag.
This commit is contained in:
parent
5f4f4b08b0
commit
fe870f073a
@ -40,6 +40,8 @@ module.exports = {
|
||||
'dot-location': ['error', 'property'],
|
||||
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
||||
'max-len': ['error', { code: 120, ignoreUrls: true }],
|
||||
'mocha/no-exports': 'off', // we are not using Mocha
|
||||
'mocha/no-skipped-tests': 'off', // we are not using Mocha
|
||||
'new-cap': 'off', // used for RDF constants
|
||||
'no-param-reassign': 'off', // necessary in constructor overloading
|
||||
'no-underscore-dangle': 'off', // conflicts with external libraries
|
||||
|
@ -11,6 +11,7 @@ services:
|
||||
|
||||
before_install:
|
||||
- npm run docker
|
||||
- export TEST_DOCKER=1
|
||||
|
||||
script:
|
||||
- npm run lint
|
||||
|
@ -9,6 +9,7 @@ module.exports = {
|
||||
rules: {
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'unicorn/no-useless-undefined': 'off',
|
||||
'no-process-env': 'off',
|
||||
|
||||
// Need these 2 to run tests for throwing non-Error objects
|
||||
'@typescript-eslint/no-throw-literal': 'off',
|
||||
|
@ -4,9 +4,9 @@ import { INTERNAL_QUADS } from '../../src/util/ContentTypes';
|
||||
import { MetadataController } from '../../src/util/MetadataController';
|
||||
import { DataAccessorBasedConfig } from '../configs/DataAccessorBasedConfig';
|
||||
import { BASE } from '../configs/Util';
|
||||
import { FileTestHelper } from '../util/TestHelpers';
|
||||
import { describeIf, FileTestHelper } from '../util/TestHelpers';
|
||||
|
||||
describe('A server with a SPARQL endpoint as storage', (): void => {
|
||||
describeIf('docker', 'a server with a SPARQL endpoint as storage', (): void => {
|
||||
describe('without acl', (): void => {
|
||||
const config = new DataAccessorBasedConfig(BASE,
|
||||
new SparqlDataAccessor('http://localhost:4000/sparql',
|
||||
|
@ -214,3 +214,10 @@ export class FileTestHelper {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
export const describeIf = (envFlag: string, name: string, fn: () => void): void => {
|
||||
const flag = `TEST_${envFlag.toUpperCase()}`;
|
||||
const enabled = !/^(|0|false)$/iu.test(process.env[flag] ?? '');
|
||||
// eslint-disable-next-line jest/valid-describe, jest/valid-title, jest/no-disabled-tests
|
||||
return enabled ? describe(name, fn) : describe.skip(name, fn);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user