Closed usmansbk closed 1 year ago
Hello! Cool utility package. 🚀
I wrote a simple test to make sure the variables are working as expected on CI. But I keep getting the initial environment variable even after changing the variable and running npx dotenv-vault push ci
npx dotenv-vault push ci
Test
test("test", () => { expect(process.env.APP_NAME).toBe("Timetable"); });
GitHub actions result
yarn run v1.22.19 $ jest console.log [dotenv-vault-core@0.6.1][INFO] Loading env from encrypted .env.vault at _log (node_modules/dotenv-vault-core/lib/main.js:10:11) FAIL tests/index.test.ts ✕ test ([9](https://github.com/usmansbk/apollo-server-template/actions/runs/3508843256/jobs/5877537414#step:5:10) ms) ● test ----------|---------|----------|---------|---------|------------------- expect(received).toBe(expected) // Object.is equality Expected: "Timetable" Received: "Timetable_Test"
.env.ci
# ci APP_NAME="Timetable"
.env.ci.previous
# ci APP_NAME="Timetable_Test"
Git Action
name: ci on: push: branches: - "dev" jobs: test_and_build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Node uses: actions/setup-node@v3 with: node-version: "16" - name: Install dependencies run: yarn - name: Run tests run: yarn test env: DOTENV_KEY: ${{ secrets.DOTENV_KEY }} - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Build and push uses: docker/build-push-action@v3 with: context: . file: ./Dockerfile push: true tags: ${{ secrets.DOCKER_HUB_USERNAME }}/apollo-server:latest
jest.config.ts
export default { setupFiles: ["dotenv-vault-core/config"] }
UPDATED
Same with local test
Worked after rebuilding with npx dotenv-vault build.
npx dotenv-vault build
Hello! Cool utility package. 🚀
I wrote a simple test to make sure the variables are working as expected on CI. But I keep getting the initial environment variable even after changing the variable and running
npx dotenv-vault push ci
Test
GitHub actions result
.env.ci
.env.ci.previous
Git Action
jest.config.ts
UPDATED
Same with local test