From 36d83a9f08a10614c7fbbbb2359fa03d17161598 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Fri, 3 May 2024 14:26:12 -0400 Subject: [PATCH] cleaning up --- scripts/generate_docs.cjs | 24 ----- test/karma.conf.cjs | 173 ------------------------------------- test/scripts/node_test.cjs | 10 --- 3 files changed, 207 deletions(-) delete mode 100644 scripts/generate_docs.cjs delete mode 100644 test/karma.conf.cjs delete mode 100644 test/scripts/node_test.cjs diff --git a/scripts/generate_docs.cjs b/scripts/generate_docs.cjs deleted file mode 100644 index 207fed28..00000000 --- a/scripts/generate_docs.cjs +++ /dev/null @@ -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(); diff --git a/test/karma.conf.cjs b/test/karma.conf.cjs deleted file mode 100644 index de3ee05e..00000000 --- a/test/karma.conf.cjs +++ /dev/null @@ -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); -}; diff --git a/test/scripts/node_test.cjs b/test/scripts/node_test.cjs deleted file mode 100644 index 7b282d2f..00000000 --- a/test/scripts/node_test.cjs +++ /dev/null @@ -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");