mirror of
https://github.com/Tonejs/Tone.js
synced 2024-12-26 03:23:11 +00:00
cleaning up
This commit is contained in:
parent
192d9b0c9c
commit
36d83a9f08
3 changed files with 0 additions and 207 deletions
|
@ -1,24 +0,0 @@
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires, no-console */
|
|
||||||
const { resolve } = require("path");
|
|
||||||
const { execSync } = require("child_process");
|
|
||||||
const { writeFileSync, readFileSync, unlinkSync } = require("fs");
|
|
||||||
|
|
||||||
function generateDocs() {
|
|
||||||
const commitHash = execSync("git rev-parse --short HEAD").toString().trim();
|
|
||||||
console.log(`commit hash ${commitHash}`);
|
|
||||||
const outputDir = resolve(__dirname, "../docs");
|
|
||||||
const tmpFile = resolve(outputDir, "tmp.json");
|
|
||||||
const outputFile = resolve(outputDir, "tone.json");
|
|
||||||
// generate the doc file
|
|
||||||
execSync(`npm run docs:json --docs_json=${tmpFile}`);
|
|
||||||
// add the version and commit to the file
|
|
||||||
const json = JSON.parse(readFileSync(tmpFile, "utf-8"));
|
|
||||||
console.log(`doc files: ${json.children.length}`);
|
|
||||||
json.commit = commitHash;
|
|
||||||
const package = JSON.parse(readFileSync(resolve(__dirname, "../package.json"), "utf-8"));
|
|
||||||
json.version = package.version;
|
|
||||||
writeFileSync(outputFile, JSON.stringify(json));
|
|
||||||
unlinkSync(tmpFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
generateDocs();
|
|
|
@ -1,173 +0,0 @@
|
||||||
/* eslint-disable no-console, @typescript-eslint/no-var-requires */
|
|
||||||
// Karma configuration
|
|
||||||
const path = require("path");
|
|
||||||
const argv = require("yargs").alias("i", "file").alias("d", "dir").argv;
|
|
||||||
|
|
||||||
let BROWSERS = ["HeadlessChrome", "HeadlessFirefox", "Safari"];
|
|
||||||
|
|
||||||
// get the entry point files
|
|
||||||
let entryPoints = undefined;
|
|
||||||
if (typeof argv.file === "string") {
|
|
||||||
entryPoints = RegExp(`.*\\/${argv.file}\\.test\\.ts$`);
|
|
||||||
console.log(`testing file "${argv.file}"`);
|
|
||||||
} else if (typeof argv.dir === "string") {
|
|
||||||
entryPoints = RegExp(`.*${argv.dir}.*\\/.*\\.test\\.ts$`);
|
|
||||||
console.log(`testing directory "${argv.dir}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env.BROWSER === "chrome") {
|
|
||||||
BROWSERS = ["HeadlessChrome"];
|
|
||||||
} else if (process.env.BROWSER === "firefox") {
|
|
||||||
BROWSERS = ["HeadlessFirefox"];
|
|
||||||
} else if (process.env.BROWSER === "safari") {
|
|
||||||
BROWSERS = ["Safari"];
|
|
||||||
} else {
|
|
||||||
BROWSERS = ["HeadlessChrome", "HeadlessFirefox"];
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
|
||||||
const configuration = {
|
|
||||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
|
||||||
basePath: "../",
|
|
||||||
|
|
||||||
// frameworks to use
|
|
||||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
|
||||||
frameworks: ["mocha", "karma-typescript"],
|
|
||||||
|
|
||||||
// list of files / patterns to load in the browser
|
|
||||||
files: [
|
|
||||||
"test/**/*.ts",
|
|
||||||
"Tone/**/*.ts",
|
|
||||||
{ pattern: "test/audio/**", included: false },
|
|
||||||
{ pattern: "test/html/**", included: false },
|
|
||||||
],
|
|
||||||
|
|
||||||
// Karma Typescript compiler options
|
|
||||||
karmaTypescriptConfig: {
|
|
||||||
compilerOptions: {
|
|
||||||
target: "es6",
|
|
||||||
module: "commonjs",
|
|
||||||
},
|
|
||||||
bundlerOptions: {
|
|
||||||
resolve: {
|
|
||||||
directories: ["Tone", "node_modules", "test"],
|
|
||||||
},
|
|
||||||
entrypoints: entryPoints,
|
|
||||||
},
|
|
||||||
coverageOptions: {
|
|
||||||
exclude: /(.*\.test\.ts|test\/.*\.ts)$/i,
|
|
||||||
},
|
|
||||||
reports: {
|
|
||||||
html: path.resolve(__dirname, "../coverage"),
|
|
||||||
lcovonly: {
|
|
||||||
directory: path.resolve(__dirname, "../coverage"),
|
|
||||||
filename: "coverage.lcov",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tsconfig: "./tsconfig.json",
|
|
||||||
},
|
|
||||||
|
|
||||||
// list of files to exclude
|
|
||||||
exclude: ["node_modules/*"],
|
|
||||||
|
|
||||||
// preprocess matching files before serving them to the browser
|
|
||||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
|
||||||
preprocessors: {
|
|
||||||
"**/*.ts": "karma-typescript",
|
|
||||||
// "Tone/**/*.ts": "coverage",
|
|
||||||
},
|
|
||||||
|
|
||||||
// test results reporter to use
|
|
||||||
// possible values: 'dots', 'progress'
|
|
||||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
|
||||||
reporters: ["dots", "karma-typescript"],
|
|
||||||
|
|
||||||
// coverageReporter : {
|
|
||||||
// type : "lcov",
|
|
||||||
// dir: path.resolve(__dirname, "../coverage"),
|
|
||||||
// },
|
|
||||||
|
|
||||||
// plugins
|
|
||||||
plugins: [
|
|
||||||
"karma-typescript",
|
|
||||||
// "karma-coverage",
|
|
||||||
"karma-mocha",
|
|
||||||
"karma-chrome-launcher",
|
|
||||||
"karma-firefox-launcher",
|
|
||||||
"karma-safari-launcher",
|
|
||||||
// "karma-sourcemap-loader",
|
|
||||||
],
|
|
||||||
|
|
||||||
client: {
|
|
||||||
mocha: {
|
|
||||||
reporter: "html",
|
|
||||||
timeout: 10000,
|
|
||||||
retries: 2,
|
|
||||||
ui: "bdd",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// web server port
|
|
||||||
port: 9876,
|
|
||||||
|
|
||||||
// enable / disable colors in the output (reporters and logs)
|
|
||||||
colors: true,
|
|
||||||
|
|
||||||
// set the inactivity level to longer
|
|
||||||
browserNoActivityTimeout: 40000,
|
|
||||||
browserDisconnectTimeout: 30000,
|
|
||||||
|
|
||||||
// level of logging
|
|
||||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
||||||
logLevel: config.LOG_ERROR,
|
|
||||||
|
|
||||||
// enable / disable watching file and executing tests whenever any file changes
|
|
||||||
autoWatch: false,
|
|
||||||
// restartOnFileChange : true,
|
|
||||||
|
|
||||||
// start these browsers
|
|
||||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
|
||||||
browsers: BROWSERS,
|
|
||||||
|
|
||||||
// Continuous Integration mode
|
|
||||||
// if true, Karma captures browsers, runs the tests and exits
|
|
||||||
singleRun: false,
|
|
||||||
|
|
||||||
// Concurrency level
|
|
||||||
// how many browser should be started simultaneous
|
|
||||||
// concurrency: process.env.TRAVIS ? 1 : Infinity,
|
|
||||||
concurrency: Infinity,
|
|
||||||
|
|
||||||
// custom launcher for travis
|
|
||||||
customLaunchers: {
|
|
||||||
HeadlessChrome: {
|
|
||||||
base: "ChromeHeadless",
|
|
||||||
flags: [
|
|
||||||
"--no-sandbox",
|
|
||||||
"--use-fake-ui-for-media-stream",
|
|
||||||
"--use-fake-device-for-media-stream",
|
|
||||||
"--autoplay-policy=no-user-gesture-required",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
HeadlessFirefox: {
|
|
||||||
base: "Firefox",
|
|
||||||
flags: ["-headless"],
|
|
||||||
prefs: {
|
|
||||||
"focusmanager.testmode": true,
|
|
||||||
"media.navigator.permission.disabled": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
OnlineChrome: {
|
|
||||||
base: "Chrome",
|
|
||||||
flags: [
|
|
||||||
"--no-sandbox",
|
|
||||||
"--use-fake-ui-for-media-stream",
|
|
||||||
"--use-fake-device-for-media-stream",
|
|
||||||
"--autoplay-policy=no-user-gesture-required",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
config.set(configuration);
|
|
||||||
};
|
|
|
@ -1,10 +0,0 @@
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
||||||
// test the tone.js build
|
|
||||||
const Tone = require("../../build/esm");
|
|
||||||
const assert = require("assert");
|
|
||||||
const semver = require("semver");
|
|
||||||
const { version } = require("../../package.json");
|
|
||||||
|
|
||||||
// test the version
|
|
||||||
const diff = semver.diff(Tone.version, version);
|
|
||||||
assert(diff === "patch" || diff === null, "wrong version listed");
|
|
Loading…
Reference in a new issue