diff --git a/.vscodeignore b/.vscodeignore index c1aa5abce..99a00ecd2 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -8,3 +8,5 @@ scripts/** .gitignore tsconfig.json tslint.json +.editorconfig +.travis.yml diff --git a/test/extension.test.ts b/test/extension.test.ts index c63c46b7d..62009fd67 100644 --- a/test/extension.test.ts +++ b/test/extension.test.ts @@ -9,13 +9,30 @@ import * as assert from 'assert'; // You can import and use all API from the 'vscode' module // as well as import your extension to test it import * as vscode from 'vscode'; -import * as myExtension from '../src/extension'; - -// Defines a Mocha test suite to group tests of similar kind together -suite('Extension Tests', () => { - // Defines a Mocha unit test - test('Something 1', () => { - assert.equal(-1, [1, 2, 3].indexOf(5)); - assert.equal(-1, [1, 2, 3].indexOf(0)); + + +suite('Shellcheck extension', () => { + const ext = vscode.extensions.getExtension('timonwong.shellcheck'); + + test('Extension should not be activated', async () => { + const plaintextDocument = await vscode.workspace.openTextDocument({ + content: 'hello', + language: 'plaintext', + }); + + await vscode.window.showTextDocument(plaintextDocument); + + assert.equal(ext.isActive, false, 'should not be activated when file type is not shell script.'); + }); + + test('Extension should be activated on shell script files', async () => { + const shellscriptDocument = await vscode.workspace.openTextDocument({ + content: '#!/bin/bash\n', + language: 'shellscript', + }); + + await vscode.window.showTextDocument(shellscriptDocument); + + assert.equal(ext.isActive, true, 'should be activated when file type is shellscript.'); }); });