Remove tests types from distribution files

This commit is contained in:
Xon 2024-08-05 22:50:08 +08:00
commit a2f5632829
87 changed files with 122 additions and 168 deletions

View file

@ -19,6 +19,7 @@
"ecmaVersion": 2020
},
"rules": {
"import/no-named-as-default": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": [
"error",

View file

@ -27,7 +27,7 @@
"mocha.env": {
"NODE_ENV": "test"
},
"mocha.files.glob": "src/scripts/**/*.test.js",
"mocha.files.glob": "test/scripts/**/*.test.js",
"mocha.requires": ["@babel/register", "./config/jsdom.js"],
// for Windows collaborators
"files.eol": "\n",

View file

@ -5,6 +5,7 @@
### Bug Fixes (from 10.2.0)
* Fix `aria-describedby` was being assigned when it shouldn't be
* Fix `select-one` placeholder could ignore the non-option placeholder configuration
* Remove typescript types for tests from distribution
### Chore
* Reduce bundle size from ~24KB to ~22.4KB

8
cypress/tsconfig.json Normal file
View file

@ -0,0 +1,8 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["cypress"],
"declarationDir": "../public/types/cypress"
},
"include": ["."]
}

View file

@ -40,9 +40,7 @@
"public/assets/scripts",
"public/assets/styles",
"public/types",
"src",
"!src/**/*.test.js",
"types"
"src"
],
"bugs": {
"url": "https://github.com/jshjohnson/Choices/issues"
@ -129,7 +127,7 @@
"src/scripts/**/**/*.js"
],
"exclude": [
"src/scripts/**/**/*.test.js"
"test"
]
},
"sideEffects": false,

View file

@ -1 +0,0 @@
//# sourceMappingURL=select-multiple.spec.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"select-multiple.spec.d.ts","sourceRoot":"","sources":["../../../../cypress/e2e/select-multiple.spec.ts"],"names":[],"mappings":""}

View file

@ -1 +0,0 @@
//# sourceMappingURL=select-one.spec.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"select-one.spec.d.ts","sourceRoot":"","sources":["../../../../cypress/e2e/select-one.spec.ts"],"names":[],"mappings":""}

View file

@ -1 +0,0 @@
//# sourceMappingURL=text.spec.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"text.spec.d.ts","sourceRoot":"","sources":["../../../../cypress/e2e/text.spec.ts"],"names":[],"mappings":""}

View file

@ -1,3 +0,0 @@
declare function _exports(on: any, config: any): void;
export = _exports;
//# sourceMappingURL=index.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../cypress/plugins/index.js"],"names":[],"mappings":"AAaiB,sDAGhB"}

View file

@ -1 +0,0 @@
//# sourceMappingURL=commands.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../cypress/support/commands.js"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=e2e.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../../../cypress/support/e2e.js"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=choices.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"choices.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/actions/choices.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=groups.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"groups.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/actions/groups.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=items.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"items.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/actions/items.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=misc.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"misc.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/actions/misc.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=choices.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"choices.test.d.ts","sourceRoot":"","sources":["../../../../src/scripts/choices.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=container.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"container.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/container.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=dropdown.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"dropdown.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/dropdown.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=input.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"input.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/input.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=list.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"list.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/list.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=wrapped-element.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"wrapped-element.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/wrapped-element.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=wrapped-input.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"wrapped-input.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/wrapped-input.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=wrapped-select.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"wrapped-select.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/components/wrapped-select.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=constants.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"constants.test.d.ts","sourceRoot":"","sources":["../../../../src/scripts/constants.test.ts"],"names":[],"mappings":""}

View file

@ -1,5 +1,8 @@
export * from './action-type';
export * from './choices';
export * from './input-choice';
export * from './input-group';
export * from './event-choice';
export * from './class-names';
export * from './event-type';
export * from './item';

View file

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=utils.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/lib/utils.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=choices.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"choices.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/choices.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=groups.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"groups.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/groups.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=index.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/index.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=items.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"items.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/items.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=loading.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"loading.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/reducers/loading.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=store.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"store.test.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/store/store.test.ts"],"names":[],"mappings":""}

View file

@ -1,2 +0,0 @@
export {};
//# sourceMappingURL=templates.test.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"templates.test.d.ts","sourceRoot":"","sources":["../../../../src/scripts/templates.test.ts"],"names":[],"mappings":""}

View file

@ -1,5 +1,8 @@
export * from './action-type';
export * from './choices';
export * from './input-choice';
export * from './input-group';
export * from './event-choice';
export * from './class-names';
export * from './event-type';
export * from './item';

7
src/tsconfig.json Normal file
View file

@ -0,0 +1,7 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"declarationDir": "../public/types/src"
},
"include": ["."]
}

View file

@ -4,6 +4,6 @@
"./config/jsdom.js"
],
"exit": true,
"spec": ["src/**/**/*.test.ts"],
"spec": ["test/**/**/*.test.ts"],
"extension": ["ts", "js"]
}

View file

@ -1,9 +1,9 @@
import { expect } from 'chai';
import * as actions from './choices';
import { cloneObject } from '../lib/utils';
import { ChoiceFull } from '../interfaces/choice-full';
import { ActionType } from '../interfaces';
import { stringToHtmlClass } from '../lib/choice-input';
import * as actions from '../../../src/scripts/actions/choices';
import { cloneObject } from '../../../src/scripts/lib/utils';
import { ChoiceFull } from '../../../src/scripts/interfaces/choice-full';
import { ActionType } from '../../../src';
import { stringToHtmlClass } from '../../../src/scripts/lib/choice-input';
describe('actions/choices', () => {
describe('addChoice action', () => {

View file

@ -1,8 +1,7 @@
import { expect } from 'chai';
import * as actions from './groups';
import { mapInputToChoice } from '../lib/choice-input';
import { InputGroup } from '../interfaces/input-group';
import { ActionType } from '../interfaces';
import * as actions from '../../../src/scripts/actions/groups';
import { mapInputToChoice } from '../../../src/scripts/lib/choice-input';
import { InputGroup, ActionType } from '../../../src';
describe('actions/groups', () => {
describe('addGroup action', () => {

View file

@ -1,8 +1,8 @@
import { expect } from 'chai';
import * as actions from './items';
import { cloneObject } from '../lib/utils';
import { ChoiceFull } from '../interfaces/choice-full';
import { ActionType } from '../interfaces';
import * as actions from '../../../src/scripts/actions/items';
import { cloneObject } from '../../../src/scripts/lib/utils';
import { ChoiceFull } from '../../../src/scripts/interfaces/choice-full';
import { ActionType } from '../../../src';
describe('actions/items', () => {
describe('addItem action', () => {

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import * as actions from './misc';
import { ActionType } from '../interfaces';
import * as actions from '../../../src/scripts/actions/misc';
import { ActionType } from '../../../src';
describe('actions/misc', () => {
describe('clearAll action', () => {

View file

@ -2,17 +2,22 @@ import chai, { expect } from 'chai';
import { spy, stub } from 'sinon';
import sinonChai from 'sinon-chai';
import Choices from './choices';
import { WrappedSelect, WrappedInput } from './components/index';
import { removeItem } from './actions/items';
import templates from './templates';
import { InputChoice } from './interfaces/input-choice';
import { InputGroup } from './interfaces/input-group';
import { DEFAULT_CONFIG } from './defaults';
import { ChoiceFull } from './interfaces/choice-full';
import { GroupFull } from './interfaces/group-full';
import { ActionType, EventType, KeyCodeMap } from './interfaces';
import Choices, {
DEFAULT_CONFIG,
ActionType,
EventType,
KeyCodeMap,
InputChoice,
InputGroup,
} from '../../src';
import {
WrappedSelect,
WrappedInput,
} from '../../src/scripts/components/index';
import { removeItem } from '../../src/scripts/actions/items';
import templates from '../../src/scripts/templates';
import { ChoiceFull } from '../../src/scripts/interfaces/choice-full';
import { GroupFull } from '../../src/scripts/interfaces/group-full';
chai.use(sinonChai);

View file

@ -1,7 +1,7 @@
import { expect } from 'chai';
import { stub } from 'sinon';
import { DEFAULT_CLASSNAMES } from '../defaults';
import Container from './container';
import { DEFAULT_CLASSNAMES } from '../../../src';
import Container from '../../../src/scripts/components/container';
describe('components/container', () => {
let instance;

View file

@ -1,7 +1,7 @@
import { expect } from 'chai';
import sinon from 'sinon';
import { DEFAULT_CLASSNAMES } from '../defaults';
import Dropdown from './dropdown';
import { DEFAULT_CLASSNAMES } from '../../../src';
import Dropdown from '../../../src/scripts/components/dropdown';
describe('components/dropdown', () => {
let instance;

View file

@ -1,7 +1,7 @@
import { expect } from 'chai';
import { stub } from 'sinon';
import { DEFAULT_CLASSNAMES } from '../defaults';
import Input from './input';
import { DEFAULT_CLASSNAMES } from '../../../src';
import Input from '../../../src/scripts/components/input';
describe('components/input', () => {
let instance;

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import { getClassNames } from '../lib/utils';
import List from './list';
import { getClassNames } from '../../../src/scripts/lib/utils';
import List from '../../../src/scripts/components/list';
describe('components/list', () => {
let instance;

View file

@ -1,7 +1,7 @@
import { expect } from 'chai';
import { getClassNames } from '../lib/utils';
import { DEFAULT_CLASSNAMES } from '../defaults';
import WrappedElement from './wrapped-element';
import { getClassNames } from '../../../src/scripts/lib/utils';
import { DEFAULT_CLASSNAMES } from '../../../src';
import WrappedElement from '../../../src/scripts/components/wrapped-element';
describe('components/wrappedElement', () => {
let instance;

View file

@ -1,8 +1,8 @@
import { expect } from 'chai';
import { stub } from 'sinon';
import { DEFAULT_CLASSNAMES } from '../defaults';
import WrappedElement from './wrapped-element';
import WrappedInput from './wrapped-input';
import { DEFAULT_CLASSNAMES } from '../../../src';
import WrappedElement from '../../../src/scripts/components/wrapped-element';
import WrappedInput from '../../../src/scripts/components/wrapped-input';
describe('components/wrappedInput', () => {
let instance;

View file

@ -1,9 +1,9 @@
import { expect } from 'chai';
import { stub, spy } from 'sinon';
import WrappedElement from './wrapped-element';
import WrappedSelect from './wrapped-select';
import Templates from '../templates';
import { DEFAULT_CLASSNAMES } from '../defaults';
import WrappedElement from '../../../src/scripts/components/wrapped-element';
import WrappedSelect from '../../../src/scripts/components/wrapped-select';
import Templates from '../../../src/scripts/templates';
import { DEFAULT_CLASSNAMES } from '../../../src';
describe('components/wrappedSelect', () => {
let instance;

View file

@ -1,6 +1,5 @@
import { expect } from 'chai';
import { SCROLLING_SPEED } from './constants';
import { DEFAULT_CLASSNAMES, DEFAULT_CONFIG } from './defaults';
import { SCROLLING_SPEED, DEFAULT_CLASSNAMES, DEFAULT_CONFIG } from '../../src';
describe('constants', () => {
describe('type checks', () => {

View file

@ -11,8 +11,8 @@ import {
parseCustomProperties,
sortByAlpha,
sortByScore,
} from './utils';
import { EventType } from '../interfaces';
} from '../../../src/scripts/lib/utils';
import { EventType } from '../../../src';
describe('utils', () => {
describe('generateId', () => {

View file

@ -1,9 +1,9 @@
import { expect } from 'chai';
import choices from './choices';
import { cloneObject } from '../lib/utils';
import { ChoiceFull } from '../interfaces/choice-full';
import { ActionType } from '../interfaces';
import { defaultState } from './index';
import choices from '../../../src/scripts/reducers/choices';
import { cloneObject } from '../../../src/scripts/lib/utils';
import { ChoiceFull } from '../../../src/scripts/interfaces/choice-full';
import { ActionType } from '../../../src';
import { defaultState } from '../../../src/scripts/reducers';
describe('reducers/choices', () => {
it('should return same state when no action matches', () => {

View file

@ -1,9 +1,9 @@
import { expect } from 'chai';
import groups from './groups';
import { cloneObject } from '../lib/utils';
import { GroupFull } from '../interfaces/group-full';
import { ActionType } from '../interfaces';
import { defaultState } from './index';
import groups from '../../../src/scripts/reducers/groups';
import { cloneObject } from '../../../src/scripts/lib/utils';
import { GroupFull } from '../../../src/scripts/interfaces/group-full';
import { ActionType } from '../../../src';
import { defaultState } from '../../../src/scripts/reducers';
describe('reducers/groups', () => {
it('should return same state when no action matches', () => {

View file

@ -1,11 +1,11 @@
import { createStore } from 'redux';
import { expect } from 'chai';
import rootReducer from '.';
import groups from './groups';
import choices from './choices';
import items from './items';
import loading from './loading';
import { ActionType } from '../interfaces';
import rootReducer from '../../../src/scripts/reducers';
import groups from '../../../src/scripts/reducers/groups';
import choices from '../../../src/scripts/reducers/choices';
import items from '../../../src/scripts/reducers/items';
import loading from '../../../src/scripts/reducers/loading';
import { ActionType } from '../../../src';
describe('reducers/rootReducer', () => {
const store = createStore(rootReducer);

View file

@ -1,10 +1,10 @@
import { expect } from 'chai';
import items from './items';
import { RemoveItemAction } from '../actions/items';
import { cloneObject } from '../lib/utils';
import { ChoiceFull } from '../interfaces/choice-full';
import { ActionType } from '../interfaces';
import { defaultState } from './index';
import items from '../../../src/scripts/reducers/items';
import { RemoveItemAction } from '../../../src/scripts/actions/items';
import { cloneObject } from '../../../src/scripts/lib/utils';
import { ChoiceFull } from '../../../src/scripts/interfaces/choice-full';
import { ActionType } from '../../../src';
import { defaultState } from '../../../src/scripts/reducers';
describe('reducers/items', () => {
it('should return same state when no action matches', () => {

View file

@ -1,7 +1,7 @@
import { expect } from 'chai';
import general from './loading';
import { ActionType } from '../interfaces';
import { defaultState } from './index';
import general from '../../../src/scripts/reducers/loading';
import { ActionType } from '../../../src';
import { defaultState } from '../../../src/scripts/reducers';
describe('reducers/loading', () => {
it('should return same state when no action matches', () => {

View file

@ -1,6 +1,6 @@
import { expect } from 'chai';
import sinon from 'sinon';
import Store from './store';
import Store from '../../../src/scripts/store/store';
describe('reducers/store', () => {
let instance;

View file

@ -1,9 +1,12 @@
import { expect } from 'chai';
import templates from './templates';
import { strToEl, getClassNames } from './lib/utils';
import { DEFAULT_CLASSNAMES, DEFAULT_CONFIG } from './defaults';
import { Options } from './interfaces/options';
import { ClassNames } from './interfaces/class-names';
import templates from '../../src/scripts/templates';
import { strToEl, getClassNames } from '../../src/scripts/lib/utils';
import {
DEFAULT_CLASSNAMES,
DEFAULT_CONFIG,
Options,
ClassNames,
} from '../../src';
/**
* @param {HTMLElement} element1

8
test/tsconfig.json Normal file
View file

@ -0,0 +1,8 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"declaration": false,
"types": ["mocha"]
},
"include": [".", "../src"]
}

View file

@ -4,7 +4,6 @@
"outDir": "./dist/",
"allowJs": true,
"declaration": true,
"declarationDir": "./public/types/",
"declarationMap": true,
"composite": true,
"sourceMap": true,
@ -17,8 +16,6 @@
"noUnusedParameters": true,
"noImplicitAny": false,
"strictNullChecks": true,
"types": ["cypress"],
"newLine": "lf"
},
"include": ["./src/**/*", "./cypress/**/*"]
}
}