Add `test` command test with no arguments (#198)

* Added test command test with no arguments

* Changed build and test to release configuration, Fixed Docker Build error

* Changed build and test to release configuration, Fixed Docker Build error

* Fixed github action

* Moved package.json and package-lock.json back to the top directory

* Moved the entrypoint folder back to the top level directory

Co-authored-by: thecb4 <cavelle@tehcb4.io>
This commit is contained in:
thecb4 2020-12-30 10:35:02 -05:00 committed by GitHub
parent 22165481bf
commit fc0487d623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 53 additions and 28 deletions

View File

@ -14,13 +14,14 @@
# Node.js
node_modules
Tests/**/node_modules
# carton
static
static.zip
TestApp/Bundle
TestApp/.build
.git
Tests/**/Bundle
Tests/**/.build
# macOS
.DS_Store

View File

@ -16,12 +16,8 @@ jobs:
run: |
sudo xcode-select --switch /Applications/Xcode_11.7.app/Contents/Developer
brew bundle
swift build -c release --build-tests --enable-test-discovery
swift test -c release --enable-test-discovery
swift build -c release
cd TestApp && ../.build/release/carton test
../.build/release/carton test --environment defaultBrowser
../.build/release/carton bundle
# the token is required to get around GitHub API limits when downloading the toolchain
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -34,11 +30,8 @@ jobs:
run: |
sudo xcode-select --switch /Applications/Xcode_11.7.app/Contents/Developer
brew bundle
swift build -c release --build-tests --enable-test-discovery
swift test -c release --enable-test-discovery
swift build -c release
cd TestApp && ../.build/release/carton test
../.build/release/carton test --environment defaultBrowser
../.build/release/carton bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -51,11 +44,8 @@ jobs:
run: |
sudo xcode-select --switch /Applications/Xcode_12.app/Contents/Developer
brew bundle
swift build -c release --build-tests --enable-test-discovery
swift test -c release --enable-test-discovery
swift build -c release
cd TestApp && ../.build/release/carton test
../.build/release/carton test --environment defaultBrowser
../.build/release/carton bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -68,11 +58,8 @@ jobs:
run: |
sudo xcode-select --switch /Applications/Xcode_12.2.app/Contents/Developer
brew bundle
swift build -c release --build-tests --enable-test-discovery
swift test -c release --enable-test-discovery
swift build -c release
cd TestApp && ../.build/release/carton test
../.build/release/carton test --environment defaultBrowser
../.build/release/carton bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -87,10 +74,8 @@ jobs:
sudo ./install_ubuntu_deps.sh
curl https://get.wasmer.io -sSfL | sh
source /home/runner/.wasmer/wasmer.sh
swift build -c release --build-tests --enable-test-discovery
swift test -c release --enable-test-discovery
swift build -c release
cd TestApp && ../.build/release/carton test
../.build/release/carton bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -104,10 +89,8 @@ jobs:
sudo ./install_ubuntu_deps.sh
curl https://get.wasmer.io -sSfL | sh
source /home/runner/.wasmer/wasmer.sh
swift build -c release --build-tests --enable-test-discovery
swift test -c release --enable-test-discovery
swift build -c release
cd TestApp && ../.build/release/carton test
../.build/release/carton bundle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3
.gitignore vendored
View File

@ -94,11 +94,12 @@ Public
# Node.js
node_modules
Tests/**/node_modules
# carton
static
static.zip
TestApp/Bundle
Tests/**/Bundle
# macOS
.DS_Store

View File

@ -24,9 +24,8 @@ COPY . carton/
RUN cd carton && \
./install_ubuntu_deps.sh && \
swift build -c release --build-tests --enable-test-discovery && \
swift test -c release --enable-test-discovery && \
swift build -c release && \
cd TestApp && ../.build/release/carton test && cd .. && \
mv .build/release/carton /usr/bin && \
cd .. && \
rm -rf carton /tmp/wasmer*

View File

@ -0,0 +1,41 @@
// Copyright 2020 Carton contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Created by Cavelle Benjamin on Dec/28/20.
//
@testable import CartonCLI
import TSCBasic
import XCTest
extension TestCommandTests: Testable {}
final class TestCommandTests: XCTestCase {
func testWithNoArguments() throws {
// given I've created a directory
let package = "TestApp"
let packageDirectory = testFixturesDirectory.appending(components: "carton-test", package)
XCTAssertTrue(packageDirectory.exists, "The carton-test/TestApp directory does not exist")
AssertExecuteCommand(
command: "carton test",
cwd: packageDirectory.url
)
// finally, clean up
let buildDirectory = packageDirectory.appending(component: ".build")
do { try buildDirectory.delete() } catch {}
}
}