🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@databases/mysql-test

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@databases/mysql-test - npm Package Compare versions

Comparing version

to
1.0.1

5

jest/globalSetup.d.ts
// @autogenerated
export * from '../lib/jest/globalSetup';
import def from '../lib/jest/globalSetup';
export default def;
export * from '../lib/jest/globalSetup';

4

jest/globalTeardown.d.ts
// @autogenerated
export * from '../lib/jest/globalTeardown';
import def from '../lib/jest/globalTeardown';
export default def;

@@ -0,1 +1,6 @@

import { Options } from '../';
export declare const killers: Array<() => Promise<void>>;
export default function setup(opts?: Partial<Options> & {
environmentVariable?: string;
migrationsScript?: string[];
}): Promise<void>;

@@ -34,25 +34,30 @@ "use strict";

exports.killers = [];
module.exports = (opts = {}) => __awaiter(undefined, void 0, void 0, function* () {
const envVar = opts.environmentVariable || DEFAULT_ENV_VAR;
const migrationsScript = opts.migrationsScript || (process.env.MYSQL_TEST_MIGRATIONS_SCRIPT ? process.env.MYSQL_TEST_MIGRATIONS_SCRIPT.split(' ') : config.test.migrationsScript);
if (process.env[envVar]) {
console.info(`Using existing mysql database from: ${envVar}`);
return;
}
const { databaseURL, kill } = yield __1.default(opts);
console.info(`Setting mysql connection string on environment: ${envVar}`);
process.env[envVar] = databaseURL;
if (migrationsScript) {
console.info('Running mysql migrations');
yield __1.run(migrationsScript[0], migrationsScript.slice(1), {
debug: opts.debug || opts.debug === undefined && config.test.debug || false,
name: migrationsScript.join(' ')
});
}
exports.killers.push(() => __awaiter(this, void 0, void 0, function* () {
delete process.env[envVar];
yield kill();
}));
});
function setup(opts = {}) {
return __awaiter(this, void 0, void 0, function* () {
const envVar = opts.environmentVariable || DEFAULT_ENV_VAR;
const migrationsScript = opts.migrationsScript || (process.env.MYSQL_TEST_MIGRATIONS_SCRIPT ? process.env.MYSQL_TEST_MIGRATIONS_SCRIPT.split(' ') : config.test.migrationsScript);
if (process.env[envVar]) {
console.info(`Using existing mysql database from: ${envVar}`);
return;
}
const { databaseURL, kill } = yield __1.default(opts);
console.info(`Setting mysql connection string on environment: ${envVar}`);
process.env[envVar] = databaseURL;
if (migrationsScript) {
console.info('Running mysql migrations');
yield __1.run(migrationsScript[0], migrationsScript.slice(1), {
debug: opts.debug || opts.debug === undefined && config.test.debug || false,
name: migrationsScript.join(' ')
});
}
exports.killers.push(() => __awaiter(this, void 0, void 0, function* () {
delete process.env[envVar];
yield kill();
}));
});
}
exports.default = setup;
module.exports = setup;
module.exports.default = setup;
module.exports.killers = exports.killers;
//# sourceMappingURL=globalSetup.js.map

@@ -1,1 +0,1 @@

export {};
export default function teardown(): Promise<void>;

@@ -30,7 +30,12 @@ "use strict";

const globalSetup_1 = require("./globalSetup");
module.exports = () => __awaiter(undefined, void 0, void 0, function* () {
yield Promise.all(globalSetup_1.killers.map(kill => __awaiter(this, void 0, void 0, function* () {
return yield kill();
})));
});
function teardown() {
return __awaiter(this, void 0, void 0, function* () {
yield Promise.all(globalSetup_1.killers.map(kill => __awaiter(this, void 0, void 0, function* () {
return yield kill();
})));
});
}
exports.default = teardown;
module.exports = teardown;
module.exports.default = teardown;
//# sourceMappingURL=globalTeardown.js.map
{
"name": "@databases/mysql-test",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -12,3 +12,3 @@ // @public

module.exports = async (
export default async function setup(
opts: Partial<Options> & {

@@ -18,3 +18,3 @@ environmentVariable?: string;

} = {},
) => {
) {
const envVar: string = opts.environmentVariable || DEFAULT_ENV_VAR;

@@ -45,4 +45,6 @@ const migrationsScript =

});
};
}
module.exports = setup;
module.exports.default = setup;
module.exports.killers = killers;

@@ -5,4 +5,7 @@ // @public

module.exports = async () => {
export default async function teardown() {
await Promise.all(killers.map(async kill => await kill()));
};
}
module.exports = teardown;
module.exports.default = teardown;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet