1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Tools: Moved testing under "npm run test" and clean-up no longer used shell scripts

This commit is contained in:
Laurent Cozic 2020-02-21 12:15:06 +00:00
parent 2d1aa27955
commit b4b424bf8a
12 changed files with 39 additions and 39 deletions

View File

@ -66,7 +66,7 @@ script:
# and that would break the desktop release.
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
cd CliClient
./run_test.sh
npm run test
testResult=$?
if [ $testResult -ne 0 ]; then
exit $testResult

View File

@ -75,8 +75,6 @@ If `yarn dist` fails, it may need administrative rights.
If you get an `error MSB8020: The build tools for v140 cannot be found.` try to run with a different toolset version, eg `npm install --toolset=v141` (See [here](https://github.com/mapbox/node-sqlite3/issues/1124) for more info).
The [building\_win32\_tips on this page](./readme/building_win32_tips.md) might be helpful.
## Other issues
> The application window doesn't open or is white

View File

@ -61,19 +61,19 @@ npm install
To run all the test units:
```sh
./run_test.sh
npm run test
```
To run just one particular file:
```sh
./run_test.sh markdownUtils # Don't add the .js extension
npm run test -- --filter=markdownUtils # Don't add the .js extension
```
To filter tests:
To filter tests. For example, to run all the test units that contain "should handle conflict" in their description:
```sh
./run_test.sh "should handle conflict" # Will run all the test units that contain "should handle conflict" in their description
npm run test -- --filter="should handle conflict"
```
If you get the error `Cannot find module '/joplin/CliClient/node_modules/sqlite3/lib/binding/node-v79-darwin-x64/node_sqlite3.node'`, you may need to run `npm rebuild`.

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -e
./build.sh && NODE_PATH=build node build/build-doc.js
npm run build && NODE_PATH=build node build/build-doc.js

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -e
./build.sh && NODE_PATH="build/" node build/cli-integration-tests.js
npm run build && NODE_PATH="build/" node build/cli-integration-tests.js

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -e
./build.sh && NODE_PATH="build/" node build/fuzzing.js
npm run build && NODE_PATH="build/" node build/fuzzing.js

View File

@ -5,10 +5,9 @@ const tasks = {
copyLib: require('../Tools/gulp/tasks/copyLib'),
};
const buildDir = `${__dirname}/build`;
tasks.build = {
fn: async () => {
const buildDir = `${__dirname}/build`;
await utils.copyDir(`${__dirname}/app`, buildDir, {
excluded: ['node_modules'],
});
@ -19,4 +18,23 @@ tasks.build = {
},
};
tasks.buildTests = {
fn: async () => {
const testBuildDir = `${__dirname}/tests-build`;
await utils.copyDir(`${__dirname}/tests`, testBuildDir, {
excluded: [
'lib/',
'locales/',
'node_modules/',
],
});
await utils.copyDir(`${__dirname}/../ReactNativeClient/lib`, `${testBuildDir}/lib`);
await utils.copyDir(`${__dirname}/../ReactNativeClient/locales`, `${testBuildDir}/locales`);
await fs.mkdirp(`${testBuildDir}/data`);
},
};
gulp.task('build', tasks.build.fn);
gulp.task('buildTests', tasks.buildTests.fn);

View File

@ -4,6 +4,7 @@
"license": "MIT",
"author": "Laurent Cozic",
"scripts": {
"test": "gulp buildTests -L && jasmine --config=tests/support/jasmine.json",
"postinstall": "patch-package && npm run build",
"build": "gulp build",
"start": "gulp build -L && node 'build/main.js' --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev"

View File

@ -1,24 +0,0 @@
#!/bin/bash
START_DIR="$(pwd)"
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR="$ROOT_DIR/tests-build"
FILTER="$1"
rsync -a --delete --exclude "lib/" --exclude "locales/" --exclude "node_modules/" "$ROOT_DIR/tests/" "$BUILD_DIR/"
rsync -a --delete "$ROOT_DIR/../ReactNativeClient/lib/" "$BUILD_DIR/lib/"
rsync -a --delete "$ROOT_DIR/../ReactNativeClient/locales/" "$BUILD_DIR/locales/"
mkdir -p "$BUILD_DIR/data"
function finish {
cd "$START_DIR"
}
trap finish EXIT
cd "$ROOT_DIR"
if [[ $FILTER != "" ]]; then
npx jasmine --config=tests/support/jasmine.json --filter="$FILTER"
else
npx jasmine --config=tests/support/jasmine.json
fi

View File

@ -7,7 +7,9 @@ echo "---------------------------------------------------"
echo "Rebuild API doc..."
echo "---------------------------------------------------"
# TODO: When the apidoc command fails, it copy the failure in api.md, but shouldn't be doing that
"$ROOT_DIR/../CliClient/run.sh" apidoc > "$ROOT_DIR/../readme/api.md"
cd "$ROOT_DIR/../CliClient"
npm run start -- apidoc > "$ROOT_DIR/../readme/api.md"
cd "$ROOT_DIR"
echo "---------------------------------------------------"
echo "$ROOT_DIR/update-readme-download.js..."

View File

@ -56,8 +56,9 @@ async function main() {
console.info(`Building ${newVersion}...`);
const newTag = `cli-${newVersion}`;
await execCommand('git pull');
await execCommand('touch app/main.js');
await execCommand('bash build.sh');
await execCommand('npm run build');
await execCommand('cp package.json build/');
await execCommand('cp ../README.md build/');
@ -74,7 +75,6 @@ async function main() {
const defaultEditor = await execCommand('echo $EDITOR');
const finalCmds = [
'git pull',
'git add -A',
`git commit -m "CLI ${newVersion}"`,
`git tag "cli-${newVersion}"`,

View File

@ -1,3 +1,8 @@
* * *
**IMPORTANT: The build system has been changed since this document was written, thus it contains outdated information. It is kept for now as it may still contain some tips on how to get things working.**
* * *
## Building Joplin on Windows