Skip to content

Commit

Permalink
Build: Cleanly separate src/ between src/core/ and src/cli/
Browse files Browse the repository at this point in the history
Ref #1726.
  • Loading branch information
Krinkle committed Jul 15, 2024
1 parent d395525 commit 580d94f
Show file tree
Hide file tree
Showing 72 changed files with 79 additions and 81 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (grunt) {
options: { process: preprocess },

'src-css': {
src: 'src/qunit.css',
src: 'src/core/qunit.css',
dest: 'qunit/qunit.css'
}
},
Expand Down
2 changes: 1 addition & 1 deletion build/watch.js → build/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function startRollupWatch () {

async function startCssWatch () {
const baseDir = process.cwd();
const cssInputFile = path.resolve(baseDir, 'src/qunit.css');
const cssInputFile = path.resolve(baseDir, 'src/core/qunit.css');
const cssOutputFile = path.resolve(baseDir, 'qunit/qunit.css');

function copyCss () {
Expand Down
2 changes: 1 addition & 1 deletion demos/q4000-qunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>q4000 on QUnit</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
</head>
<body>
<div id="qunit"></div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"scripts": {
"build": "rollup -c && grunt copy:src-css",
"build-coverage": "rollup -c --environment BUILD_TARGET:coverage && grunt copy:src-css",
"build-dev": "node build/watch.js",
"build-dev": "node build/dev.js",
"benchmark": "npm install --silent --no-audit --prefix test/benchmark/ && node test/benchmark/micro.js",
"lint": "eslint --cache .",
"lint-fix": "eslint --cache --fix .",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { replacements } = require('./build/dist-replace.js');
const isCoverage = process.env.BUILD_TARGET === 'coverage';

module.exports = {
input: 'src/qunit.js',
input: 'src/core/qunit.js',
output: {
file: 'qunit/qunit.js',
sourcemap: isCoverage,
Expand Down
6 changes: 3 additions & 3 deletions src/assert.js → src/core/assert.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import dump from './dump.js';
import equiv from './equiv.js';
import config from './core/config.js';
import { objectType, objectValues, objectValuesSubset, errorString } from './core/utilities.js';
import { sourceFromStacktrace } from './core/stacktrace.js';
import config from './config.js';
import { objectType, objectValues, objectValuesSubset, errorString } from './utilities.js';
import { sourceFromStacktrace } from './stacktrace.js';
import { clearTimeout } from './globals.js';

class Assert {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/callbacks.js → src/core/callbacks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import config from './core/config.js';
import config from './config.js';
import Promise from './promise.js';

export function createRegisterCallbackFunction (key) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { globalThis, process, sessionStorage } from '../globals.js';
import { urlParams } from '../urlparams.js';
import { globalThis, process, sessionStorage } from './globals.js';
import { urlParams } from './urlparams.js';
import { extend } from './utilities.js';

/**
Expand Down
12 changes: 6 additions & 6 deletions src/core.js → src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import Assert from './assert.js';
import Test, { test, pushFailure } from './test.js';
import reporters from './reporters.js';

import config from './core/config.js';
import hooks from './core/hooks.js';
import { objectType, is, performance } from './core/utilities.js';
import config from './config.js';
import hooks from './hooks.js';
import { objectType, is, performance } from './utilities.js';
import { createRegisterCallbackFunction, runLoggingCallbacks } from './callbacks.js';
import { sourceFromStacktrace } from './core/stacktrace.js';
import ProcessingQueue from './core/processing-queue.js';
import { sourceFromStacktrace } from './stacktrace.js';
import ProcessingQueue from './processing-queue.js';

import { urlParams } from './urlparams.js';
import { on, emit } from './events.js';
import onUncaughtException from './core/on-uncaught-exception.js';
import onUncaughtException from './on-uncaught-exception.js';
import diff from './diff.js';
import version from './version.js';

Expand Down
2 changes: 1 addition & 1 deletion src/diff.js → src/core/diff.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable indent */
import { escapeText } from './core/utilities.js';
import { escapeText } from './utilities.js';

/*
* This file is a modified version of google-diff-match-patch's JavaScript implementation
Expand Down
4 changes: 2 additions & 2 deletions src/dump.js → src/core/dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
// POSSIBILITY OF SUCH DAMAGE.
// -------

import config from './core/config.js';
import { inArray, is } from './core/utilities.js';
import config from './config.js';
import { inArray, is } from './utilities.js';

export default (function () {
function quote (str) {
Expand Down
2 changes: 1 addition & 1 deletion src/equiv.js → src/core/equiv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { objectType } from './core/utilities.js';
import { objectType } from './utilities.js';
import { StringSet } from './globals.js';

const BOXABLE_TYPES = new StringSet(['boolean', 'number', 'string']);
Expand Down
4 changes: 2 additions & 2 deletions src/events.js → src/core/events.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inArray } from './core/utilities.js';
import config from './core/config.js';
import { inArray } from './utilities.js';
import config from './config.js';

const SUPPORTED_EVENTS = [
'error',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/module.js → src/core/module.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import config from './core/config.js';
import config from './config.js';
import SuiteReport from './reports/suite.js';
import { extend, generateHash, isAsyncFunction } from './core/utilities.js';
import { extend, generateHash, isAsyncFunction } from './utilities.js';

const moduleStack = [];

Expand Down
4 changes: 2 additions & 2 deletions src/core/on-uncaught-exception.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import config from './config.js';
import { runSuite } from '../module.js';
import { runSuite } from './module.js';
import { sourceFromStacktrace } from './stacktrace.js';
import { errorString } from './utilities.js';
import { emit } from '../events.js';
import { emit } from './events.js';

/**
* Handle a global error that should result in a failed test run.
Expand Down
11 changes: 5 additions & 6 deletions src/core/processing-queue.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import config from './config.js';
import { extend, generateHash, performance } from './utilities.js';
import { runLoggingCallbacks } from '../callbacks.js';

import Promise from '../promise.js';
import { runSuite } from '../module.js';
import { emit } from '../events.js';
import { setTimeout } from '../globals.js';
import { runLoggingCallbacks } from './callbacks.js';
import Promise from './promise.js';
import { runSuite } from './module.js';
import { emit } from './events.js';
import { setTimeout } from './globals.js';

/**
* Creates a seeded "sample" generator which is used for randomizing tests.
Expand Down
3 changes: 3 additions & 0 deletions src/core/promise.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import _Promise from '../../lib/promise-polyfill.js';

export default _Promise;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extend, errorString, escapeText } from '../core/utilities.js';
import { extend, errorString, escapeText } from '../utilities.js';
import diff from '../diff.js';
import dump from '../dump.js';
import { window, document, navigator, StringMap } from '../globals.js';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import kleur from 'kleur';
import { errorString } from '../core/utilities.js';
import { errorString } from '../utilities.js';
import { console } from '../globals.js';

const hasOwn = Object.prototype.hasOwnProperty;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/reports/suite.js → src/core/reports/suite.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { performance } from '../core/utilities.js';
import { performance } from '../utilities.js';

export default class SuiteReport {
constructor (name, parentSuite) {
Expand Down
2 changes: 1 addition & 1 deletion src/reports/test.js → src/core/reports/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { extend, performance } from '../core/utilities.js';
import { extend, performance } from '../utilities.js';

export default class TestReport {
constructor (name, suite, options) {
Expand Down
8 changes: 3 additions & 5 deletions src/test.js → src/core/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { emit } from './events.js';
import Assert from './assert.js';
import Logger from './logger.js';
import Promise from './promise.js';

import config from './core/config.js';
import config from './config.js';
import {
diff,
errorString,
Expand All @@ -13,11 +12,10 @@ import {
hasOwn,
inArray,
performance
} from './core/utilities.js';
} from './utilities.js';
import { runLoggingCallbacks } from './callbacks.js';
import { extractStacktrace, sourceFromStacktrace } from './core/stacktrace.js';
import { extractStacktrace, sourceFromStacktrace } from './stacktrace.js';
import dump from './dump.js';

import TestReport from './reports/test.js';

export default function Test (settings) {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/core/utilities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { window } from '../globals.js';
import { window } from './globals.js';

export const toString = Object.prototype.toString;
export const hasOwn = Object.prototype.hasOwnProperty;
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions src/promise.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/browser-runner/amd.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>amd</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
<script src="../../qunit/qunit.js"></script>
<script src="../../node_modules/requirejs/require.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/browser-runner/autostart.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>autostart</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
</head>
<body>
<div id="qunit"></div>
Expand Down
2 changes: 1 addition & 1 deletion test/browser-runner/config-fixture-null.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>config-fixture-null</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
<script src="../../qunit/qunit.js"></script>
<script src="config-fixture-null.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/browser-runner/config-fixture-string.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>config-fixture-string</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
<script src="../../qunit/qunit.js"></script>
<script src="config-fixture-string.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/browser-runner/headless.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>headless</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
<script src="../../qunit/qunit.js"></script>
<script src="../main/assert.js"></script>
<script src="../main/deepEqual.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>window.onerror with pre-existing handler</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
<script>
/* exported onerrorCallingContext */
var onerrorReturnValue, onerrorCallingContext;
Expand Down
2 changes: 1 addition & 1 deletion test/browser-runner/window-onerror.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>window-onerror (no pre-existing handler)</title>
<link rel="stylesheet" href="../../src/qunit.css">
<link rel="stylesheet" href="../../src/core/qunit.css">
<script src="../../qunit/qunit.js"></script>
<script src="./window-onerror.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/dynamic-import.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>QUnit</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
</head>
<body>
<div id="qunit"></div>
Expand Down
2 changes: 1 addition & 1 deletion test/events-filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>events-filters</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="events-filters.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/events-in-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>events-in-test</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="events-in-test.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/index-es5.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>index-es5</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script>
// For main/module.js
Expand Down
2 changes: 1 addition & 1 deletion test/index-xhtml.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8" />
<title>index-xhtml</title>
<link rel="stylesheet" href="../src/qunit.css" />
<link rel="stylesheet" href="../src/core/qunit.css" />
<script src="../qunit/qunit.js"></script>
<script>
// For main/module.js
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>QUnit Main Test Suite</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script>
// For main/module.js
Expand Down
2 changes: 1 addition & 1 deletion test/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>logs</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="logs.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/module-skip.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>module-skip</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="module-skip.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/module-todo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>module-todo</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="module-todo.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/only-each.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>only-each</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="./only-each.js"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion test/overload.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>overload</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script>
var _globalError;
window.onerror = function (error) {
Expand Down
2 changes: 1 addition & 1 deletion test/performance-mark.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>performance-mark</title>
<link rel="stylesheet" href="../src/qunit.css">
<link rel="stylesheet" href="../src/core/qunit.css">
<script src="../qunit/qunit.js"></script>
<script src="performance-mark.js"></script>
</head>
Expand Down
Loading

0 comments on commit 580d94f

Please sign in to comment.