Skip to content

Commit

Permalink
Quality of life fixes (#162)
Browse files Browse the repository at this point in the history
* Fix npm and build related issues.

* Fix windows tests

* Reenable github actions workflow

* remove extraneous build.yml

* Fix coverage reporter

* upgrade mocha and nyc to fix npm audit issue

* more coverage fixes

* Add non-coverage test.
Better test debugging

* Remove unused test compile task

* Remove unused packages.

* Better test indentation handling
  • Loading branch information
TwitchBronBron authored Apr 27, 2022
1 parent b04ee37 commit b2a8f79
Show file tree
Hide file tree
Showing 10 changed files with 382 additions and 446 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ jobs:
with:
node-version: "10.19.0"
# - run: npm run build
# - run: cd bsc-plugin && npm i
# - run: cd bsc-plugin && npm ci
# - run: cd bsc-plugin && npm run build
# - run: cd bsc-plugin && npm run lint
# - run: cd bsc-plugin && npm run test
# - run: cd bsc-plugin && npm run publish-coverage
- run: cd bsc-plugin && npm i
- run: cd bsc-plugin && npm run preversion
- run: cd bsc-plugin && npm run publish-coverage
npm-release:
#only run this task if a tag starting with 'v' was used to trigger this (i.e. a tagged release)
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Simple, mocha-and junit inspired, flexible, fun Brightscript test framework for
[![build](https://img.shields.io/github/workflow/status/georgejecook/rooibos/build.svg?logo=github)](https://github.com/georgejecook/rooibos/actions?query=workflow%3Abuild)
[![GitHub](https://img.shields.io/github/release/georgejecook/rooibos.svg?style=flat-square)](https://github.com/georgejecook/rooibos/releases)
[![NPM Version](https://badge.fury.io/js/rooibos-roku.svg?style=flat)](https://npmjs.org/package/rooibos-roku)
[![Coverage Status](https://coveralls.io/repos/github/georgejecook/rooibos/badge.svg?branch=master)](https://coveralls.io/github/georgejecook/rooibos?branch=master)

## Links
- **[Documentation](https://github.com/georgejecook/rooibos/blob/master/docs/index.md)**
Expand Down
6 changes: 1 addition & 5 deletions bsc-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ module.exports = {
},
plugins: [
'@typescript-eslint',
'no-only-tests',
'github'
'no-only-tests'
],
extends: [
'eslint:all',
Expand Down Expand Up @@ -58,7 +57,6 @@ module.exports = {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars-experimental': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-readonly': 'off',
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
'@typescript-eslint/promise-function-async': 'off',
Expand Down Expand Up @@ -96,7 +94,6 @@ module.exports = {
'function-call-argument-newline': 'off',
'function-paren-newline': 'off',
'getter-return': 'off',
'github/array-foreach': 'error',
'guard-for-in': 'off',
'id-length': 'off',
'indent': 'off',
Expand Down Expand Up @@ -192,7 +189,6 @@ module.exports = {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars-experimental': 'off',
'@typescript-eslint/dot-notation': 'off',
'github/array-foreach': 'off',
'new-cap': 'off',
'no-shadow': 'off'
}
Expand Down
61 changes: 0 additions & 61 deletions bsc-plugin/.github/workflows/build.yml

This file was deleted.

3 changes: 1 addition & 2 deletions bsc-plugin/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
"version": "0.2.0",
"configurations": [
{
"name": "Run tests (current file)",
"name": "Run tests",
"type": "node",
"request": "launch",
"smartStep": false,
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"sourceMaps": true,
"args": [
"${relativeFile}",
"--timeout",
"0"
],
Expand Down
21 changes: 6 additions & 15 deletions bsc-plugin/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
{
"version": "0.2.0",
"version": "2.0.0",
"tasks": [
{
"label": "test",
"type": "shell",
"label": "build-tests",
"command": "tsc -p .",
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
},
"options": {
"env": {
"TS_NODE_TRANSPILE_ONLY": "true"
}
"command": "npm run test:nocover",
"group": {
"kind": "test",
"isDefault": true
}
}
]
Expand Down
30 changes: 16 additions & 14 deletions bsc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,47 @@
"test": "test"
},
"dependencies": {
"@types/node": "^14.14.16",
"source-map": "^0.7.3",
"stringify-object": "^3.3.0",
"vscode-languageserver": "~6.1.1",
"vscode-languageserver-protocol": "~3.15.3"
},
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/expect": "^24.3.0",
"@types/events": "^3.0.0",
"@types/fs-extra": "^5.0.1",
"@types/mocha": "^5.2.7",
"@types/sinon": "^9.0.4",
"@types/mocha": "^9.1.1",
"@types/node": "^17.0.29",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"brighterscript": "0.45.3",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"chai-subset": "^1.6.0",
"coveralls": "^3.0.0",
"eslint": "^7.11.0",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-no-only-tests": "^2.4.0",
"fs-extra": "^10.1.0",
"minimatch": "^3.0.4",
"mocha": "^7.1.1",
"mocha": "^9.2.2",
"nyc": "^15.1.0",
"roku-deploy": "^3.2.4",
"sinon": "^9.0.2",
"source-map-support": "^0.5.13",
"trim-whitespace": "^1.3.3",
"ts-node": "^9.0.0",
"typescript": "^3.8.3",
"typescript-formatter": "^7.2.2"
"undent": "^0.1.0"
},
"peerDependencies": {
"brighterscript": "^0.45.3"
},
"scripts": {
"preversion": "npm run build && npm run lint && npm run test",
"clean": "rm -rf ./dist && mkdir dist",
"compile": "npm run clean && tsc -p .",
"prepublishOnly": "npm run build",
"lint": "eslint \"src/**\"",
"build": "npm run compile && cp -r ../framework/src/source ./dist/lib/framework",
"test": "TS_NODE_TRANSPILE_ONLY=true mocha --full-trace --bail",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"test": "nyc mocha",
"test:nocover": "mocha",
"publish-coverage": "nyc report --reporter=text-lcov | coveralls",
"publish-npm": "npm run test && npm publish",
"publish-npm:beta": "npm run test && npm publish --tag=beta",
"local": "ts-node scripts/install-local.js",
Expand All @@ -82,7 +80,8 @@
},
"nyc": {
"include": [
"src/**/!(*.spec).ts"
"src/**/*.ts",
"!src/**/*.spec.ts"
],
"extension": [
".ts"
Expand All @@ -109,6 +108,9 @@
"require": [
"source-map-support/register",
"ts-node/register"
],
"watchExtensions": [
"ts"
]
}
}
34 changes: 0 additions & 34 deletions bsc-plugin/src/lib/rooibos/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { BrsFile, ClassStatement, Expression, FunctionStatement, Statement, AnnotationExpression } from 'brighterscript';
import { createVariableExpression } from 'brighterscript';
import * as brighterscript from 'brighterscript';

import * as rokuDeploy from 'roku-deploy';
import { diagnosticCorruptTestProduced } from '../utils/Diagnostics';

export function spliceString(str: string, index: number, count: number, add: string): string {
Expand Down Expand Up @@ -147,35 +145,3 @@ export function getTokenText(operator: brighterscript.TokenKind): string {
return '';
}
}

/**
* A tagged template literal function for standardizing the path. This has to be defined as standalone function since it's a tagged template literal function,
* we can't use `object.tag` syntax.
*/
export function standardizePath(stringParts, ...expressions: any[]) {
let result = [];
for (let i = 0; i < stringParts.length; i++) {
result.push(stringParts[i], expressions[i]);
}
return driveLetterToLower(
rokuDeploy.standardizePath(
result.join('')
)
);
}

function driveLetterToLower(fullPath: string) {
if (fullPath) {
let firstCharCode = fullPath.charCodeAt(0);
if (
//is upper case A-Z
firstCharCode >= 65 && firstCharCode <= 90 &&
//next char is colon
fullPath[1] === ':'
) {
fullPath = fullPath[0].toLowerCase() + fullPath.substring(1);
}
}
return fullPath;

}
Loading

0 comments on commit b2a8f79

Please sign in to comment.